Stacked Bar Chart overlaid with a line chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
SergeyKazachenko
Posts: 4
Joined: Fri Jul 22, 2005 11:02 pm

Stacked Bar Chart overlaid with a line chart

Post by SergeyKazachenko » Fri Jul 22, 2005 11:08 pm

Please help me with my problem.
We have a set of data coming from the database:
Date,Value1,Value2,Value3
for example, "07/22", 1, 2, 10
I need to get the following:
- X axis should be date
- there should be a stacked bar chart with Value1 and Value 2 being 2 components
- there should be an overlaid line chart displaying the percentage (defined as (Value1+Value2)/Value3*100%)
My problem is that the Stacked Bar Chart feeds off the CategoryDataset, and Line Chart feeds off the XYDataset.
I actually went as far as implementing my own JDBCXYIntervalDataset, so that I could combine the StackedXYBarRenderer and StandardXYItemRenderer; however, stacked XY bars look like tiny lines, while I'd like to see the beautiful stacked bars (or even better, 3D).

Any ideas how I could get that?

SergeyKazachenko
Posts: 4
Joined: Fri Jul 22, 2005 11:02 pm

Post by SergeyKazachenko » Tue Jul 26, 2005 6:22 pm

I figured out the problem. SQL Server returns the date as a number of milliseconds, so for the chart to display day-based data I needed to set the width to 24*60*60*1000 = 86400000.0

SergeyKazachenko
Posts: 4
Joined: Fri Jul 22, 2005 11:02 pm

Post by SergeyKazachenko » Tue Jul 26, 2005 6:53 pm

David, I sent you a message through SourceForge. I would like to add the two classes that I developed (JDBCXYIntervalDataset and JDBCDateDataset) to JFreeChart, so please add me to the SourceForge project.

premkumark
Posts: 2
Joined: Thu Aug 14, 2014 3:07 pm
antibot: No, of course not.

Re: Stacked Bar Chart overlaid with a line chart

Post by premkumark » Thu Aug 14, 2014 3:28 pm

Hi Sergey Kazachenko,

I am new to jFreeChart, in my project i have to export an overlaid stacked bar chart and line chart graph from UI to pdf, I was not able to figure out how to generate the graph, i see that you have done similar thing, please share your code to do this kind of chart. I appreciate your help.

Thanks,
Prem

anush_tv
Posts: 11
Joined: Wed Nov 06, 2013 12:46 am
antibot: No, of course not.

Re: Stacked Bar Chart overlaid with a line chart

Post by anush_tv » Thu Sep 04, 2014 9:38 pm

SergeyKazachenko,

Will appreciate if you can share your solution here - I'm running into a similar problem.
I've a Gantt chart that uses GanttCategoryDataSet and I'm trying to overlay it with a line chart that uses XYDataSet. I see that you have created a custom code which will be useful for us!

Locked