I've been trying to display an overlay chart with Gantt chart & another line chart - Both charts shall have the same x-axis (dateaxis).
The Gantt chart is of type GanttCategoryDataset & the line graph is of type XYDataset.
Both charts will share the same xAxis (which is a date/time axis) - but Gantt will use CategoryPlot and line chart will use XYPlot.
How do I create combine these 2 chart types?
I checked out the overlaid charts example in demo, but could not use those classes to combine these 2 charts are they are different types of datasets/plots.
I'm stuck here and I will appreciate any direction to solve this problem.
Combined chart (Gantt + Line Chart)
Re: Combined chart (Gantt + Line Chart)
Anyone, please help!
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Combined chart (Gantt + Line Chart)
You won't be able to do it because the Gantt chart is a CategoryPlot with a "horizontal" orientation (meaning that the y-axis is running horizontally), so the vertical axis is a CategoryAxis...but for your line chart you will require a numerical vertical axis.
With quite a lot of work, you could make something that works by using an XYPlot only, where you could use the XYBarRenderer (with the useYInterval flag set to true) to generate task bars. You would have to create the dataset to represent the tasks (maybe you could use YIntervalSeriesCollection) and use a SymbolAxis to get a numerical axis with text labels. Next, you will be able to overlay a line chart because now the plot is an XYPlot.
I don't think this would be straightforward, but it is certainly possible with enough effort.
With quite a lot of work, you could make something that works by using an XYPlot only, where you could use the XYBarRenderer (with the useYInterval flag set to true) to generate task bars. You would have to create the dataset to represent the tasks (maybe you could use YIntervalSeriesCollection) and use a SymbolAxis to get a numerical axis with text labels. Next, you will be able to overlay a line chart because now the plot is an XYPlot.
I don't think this would be straightforward, but it is certainly possible with enough effort.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
Re: Combined chart (Gantt + Line Chart)
Thanks David. I could not merge these charts in the same chart. But I worked around it by placing both charts one below the other, with additional logic to align their xaxis & AxisSpace, looking just like a CombinedChart
Re: Combined chart (Gantt + Line Chart)
I want to divide the portion of chart panel in two parts.First part(Bottom part) is used for drawing of jfreechart and second part that is above the y axis line is used for displaying some other information related to graph in the form of labels.Is it possible to do so?