I'm using JSP with that code.
Every thing is fine but unable to do the bars of chart with different colors.
I have been try other solutions on forum but not getting properly.
The main problem, when creating the object of CustomRenderer class extending the BarRenderer.
how can I associate this object with my chart?
Please tell me this as using JSP.
<%
String app_path = application.getRealPath("/");
String query="SELECT * from chart";
JDBCCategoryDataset dataset=new JDBCCategoryDataset("jdbc:mysql://localhost:3306/license_server",
"com.mysql.jdbc.Driver","root","");
dataset.executeQuery( query);
JFreeChart chart = ChartFactory.createBarChart3D(
"Test",
"Id",
"Score",
dataset,
PlotOrientation.VERTICAL, true, true, false);
CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer();
renderer.setSeriesPaint(0, Color.red);
renderer.setSeriesPaint(1, Color.darkGray);
try
{
ChartUtilities.saveChartAsJPEG(new File(app_path + "chart_images/chart.jpg"), chart, 600, 500);
}
catch (IOException e)
{
System.out.println("Problem in creating chart.");
}
%>
<img src="chart_images/chart.jpg" ></img>
How to associate CustomRenderer class with the chart?
-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
Re: How to associate CustomRenderer class with the chart?
Stop posting the same question multiple times; I have already answered this question for you in Need the different colors of bars.
I would like to echo David's sentiments.
I would like to echo David's sentiments.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA