This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have created a program to draw a stacked bar chart using jfreechart. The colours in the bar are decided on their own is their any way that I could assign the different colours in the bars.
eg : On the x-axis I have "customer name" On the y-axis I have "number of days" The bars are created on the basis of what was done with the customer and how much time spent. So if it was "a meeting" then I would like the colour red , if it was "lunch" then green...
The code I have used is as below ValueAxis valueAxis = new NumberAxis("Number of Days"); sRenderer.setToolTipGenerator(new StandardCategoryToolTipGenerator()); Plot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, sRenderer); JFreeChart chart = new JFreeChart("", FreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(java.awt.Color.white);