This might be a very simple question,
I am plotting a simple Time Series chart, using StandardXYItemRenderer, and BasicTimeSeries and TimePeriod being Day.
I have data for Monday, Tuesday, Thursday and Friday...but None for Wednesday.
SO when the line is drawn I do not want it to continue on from monday, to friday continuously...i want it to connect for only the values that are able and so it should be broken for wednesday.
So, which class method I need to be looking at to make that happen?
Thanks
For TimeSeries Chart
Re: For TimeSeries Chart
You need to add data for Wednesday, but use the value null...if you leave out Wednesday, the renderer will join a line between Tuesday and Thursday.
Regards,
DG.
Regards,
DG.
Re: For TimeSeries Chart
David,
Is there any way I could not have the line at all but just data points?
Thanks
Is there any way I could not have the line at all but just data points?
Thanks
Re: For TimeSeries Chart
Hi,
I had a similar problem: I have time data which is isochromatic (e.g. a data point every 15 minutes), but sometimes there is a huge gap (e.g. 10 hours). The StandardXYRendere draws a line "crossing" this gap. I hacked it and added a new line varant called "BROKEN_LINES" which does not draw a line between two points if the gap is bigger than a specified threshold, i.e.
if ((x1-x0)/(maxx-minx)*itemCount < gap) { draw line };
The patch is rather small. I"ll clean it up a bit and post it if anyone is interested.
--nk
I had a similar problem: I have time data which is isochromatic (e.g. a data point every 15 minutes), but sometimes there is a huge gap (e.g. 10 hours). The StandardXYRendere draws a line "crossing" this gap. I hacked it and added a new line varant called "BROKEN_LINES" which does not draw a line between two points if the gap is bigger than a specified threshold, i.e.
if ((x1-x0)/(maxx-minx)*itemCount < gap) { draw line };
The patch is rather small. I"ll clean it up a bit and post it if anyone is interested.
--nk
Re: For TimeSeries Chart
Yes, you can create a new StandardXYItemRenderer:
XYItemRenderer myRenderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, new StandardXYToolTipGenerator());
Then you can set this for the plot:
XYPlot myPlot = myChart.getXYPlot();
myPlot.setXYItemRenderer(myRenderer);
Regards,
DG.
XYItemRenderer myRenderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES, new StandardXYToolTipGenerator());
Then you can set this for the plot:
XYPlot myPlot = myChart.getXYPlot();
myPlot.setXYItemRenderer(myRenderer);
Regards,
DG.
Re: For TimeSeries Chart
BROKEN_LINES : that's an excellent idea! Once you have code tidied up, please post it here or e-mail it to me and I'll incorporate it for the next version.
Regards,
DG
Regards,
DG
Re: For TimeSeries Chart
Ok, I mailed it to David, because pasting it here adds stupid line brakes which kill the patch.
The one thing I'm not totally happy about is that I compute the threshold for every datapoint over and over again (i.e. the line in my patch "(maxX-minX)/numX*this.gapThreshold"). I could add a double member var which caches the value (set it to -1 initially and in SetGapThreshold(), test and set within drawItem()). Is this worth the effort?
--nk
The one thing I'm not totally happy about is that I compute the threshold for every datapoint over and over again (i.e. the line in my patch "(maxX-minX)/numX*this.gapThreshold"). I could add a double member var which caches the value (set it to -1 initially and in SetGapThreshold(), test and set within drawItem()). Is this worth the effort?
--nk