Hi Everyone,
I want to ask a few questions :
1. How can I add a label or annotation on the Chart?? I have a Single Category bar, on which LabelGenerator is generating the values when dataset is getting refreshed. So I want a label of system time stamp should be visible on the Plot Area beside the bar where value is visible.
2. While Ploting a Category Bar Chart can there be some gap between the Ploting of the same bar graph.
For Example: Let say, I am having a dynamic bar graph with single category that plots the bar from 0-1000 with an interval of 50.
So if it plots the bar from 0-350 dynamically, then there should be a gap from 350-500 and next Ploting should start from 500 onwards. Can this be done with Category Bar Chart, or Stacked bar chart or any other Chart.
If yes then how??? what I have to do for that.
3 . My other question is, can I fix the tick marks (0-50-100-150-200-250-300......so on) ??? As they changes automatically if the size of the chart area changes. What method I have to use for that?
Please help me ....
-Ashutosh
Adding Label on the Chart....
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Adding Label on the Chart....
The reason JFreeChart uses an interface (CategoryItemLabelGenerator) to derive the item labels is precisely so that you can plug in your own implementation of the interface.ashutosh wrote:1. How can I add a label or annotation on the Chart?? I have a Single Category bar, on which LabelGenerator is generating the values when dataset is getting refreshed. So I want a label of system time stamp should be visible on the Plot Area beside the bar where value is visible.
If your x-axis is numerical, you should use XYPlot and work with the XYBarRenderer class. It's not as simple, but it is more flexible and can handle the case you described (as far as I can tell).ashutosh wrote:2. While Ploting a Category Bar Chart can there be some gap between the Ploting of the same bar graph.
For Example: Let say, I am having a dynamic bar graph with single category that plots the bar from 0-1000 with an interval of 50.
So if it plots the bar from 0-350 dynamically, then there should be a gap from 350-500 and next Ploting should start from 500 onwards. Can this be done with Category Bar Chart, or Stacked bar chart or any other Chart.
If you use an XYPlot as I've suggested, then you can call setTickUnit() on the NumberAxis that is being used for the chart's x-axis.ashutosh wrote:3 . My other question is, can I fix the tick marks (0-50-100-150-200-250-300......so on) ??? As they changes automatically if the size of the chart area changes. What method I have to use for that?
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: Adding Label on the Chart....
david.gilbert wrote:The reason JFreeChart uses an interface (CategoryItemLabelGenerator) to derive the item labels is precisely so that you can plug in your own implementation of the interface.ashutosh wrote:1. How can I add a label or annotation on the Chart?? I have a Single Category bar, on which LabelGenerator is generating the values when dataset is getting refreshed. So I want a label of system time stamp should be visible on the Plot Area beside the bar where value is visible.
If your x-axis is numerical, you should use XYPlot and work with the XYBarRenderer class. It's not as simple, but it is more flexible and can handle the case you described (as far as I can tell).ashutosh wrote:2. While Ploting a Category Bar Chart can there be some gap between the Ploting of the same bar graph.
For Example: Let say, I am having a dynamic bar graph with single category that plots the bar from 0-1000 with an interval of 50.
So if it plots the bar from 0-350 dynamically, then there should be a gap from 350-500 and next Ploting should start from 500 onwards. Can this be done with Category Bar Chart, or Stacked bar chart or any other Chart.
If you use an XYPlot as I've suggested, then you can call setTickUnit() on the NumberAxis that is being used for the chart's x-axis.ashutosh wrote:3 . My other question is, can I fix the tick marks (0-50-100-150-200-250-300......so on) ??? As they changes automatically if the size of the chart area changes. What method I have to use for that?
Thank You, David
David,
This was my query last time.....
While Ploting a Category Bar Chart can there be some gap between the Ploting of the same bar graph.
For Example: Let say, I am having a dynamic bar graph with single category that plots the bar from 0-1000 with an interval of 50.
So if it plots the bar from 0-350 dynamically, then there should be a gap from 350-500 and next Ploting should start from 500 onwards. Can this be done with Category Bar Chart, or Stacked bar chart or any other Chart.
If yes then how??? what I have to do for that.
You suggested to use XY Plot if my x-axis is numeric. But my x-axis is not numeric.
Can I do this with Cataegory Plot. if yes the how??? Please help.
Please Reply.....
This was my query last time.....
While Ploting a Category Bar Chart can there be some gap between the Ploting of the same bar graph.
For Example: Let say, I am having a dynamic bar graph with single category that plots the bar from 0-1000 with an interval of 50.
So if it plots the bar from 0-350 dynamically, then there should be a gap from 350-500 and next Ploting should start from 500 onwards. Can this be done with Category Bar Chart, or Stacked bar chart or any other Chart.
If yes then how??? what I have to do for that.
You suggested to use XY Plot if my x-axis is numeric. But my x-axis is not numeric.
Can I do this with Cataegory Plot. if yes the how??? Please help.
Please Reply.....
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
You might have to explain this some more. Is the 0-1000 on the x-axis or the y-axis?
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

