excuse me for my poor english. I'm testing JChart2D and I have some few problems.
1/ I want to visualize a trend where X axis represents time. The X axis must visualize 60 seconds maximum and my points are generated every second. 60 seconds later, the new points are not visible.
I use in my program :
long ms1=System.currentTimeMillis();
xAxis.setRangePolicy(new RangePolicyFixedViewport(new Range(ms1, ms1+60000)));
When the first 60 points are added, how can I do to tell the chart that I want a new range for X axis (ms1+60000,ms1+120000) and so on ?
2/ I only want to visualize only 4 date on X axis (ms1, ms1+20000, ms1+40000, ms1+60000) , and I use
xAxis.setAxisScalePolicy(new AxisScalePolicyManualTicks());
xAxis.setMinorTickSpacing(ms1+20000);
but it doesn't matter, how can I do that ?
3/ I would like to paint Yaxis with trace's color. Can I do that ?
Thanks a lot for your response
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. The viewpoint approach does not work (you had to shift the range everytime you update points… that is clumsy). Instead use a Trace2DLimited as trace and specify the amountOfPoints in the constructor. E.g. in this case: 60.
2. I guess this should work. If not it would be great if you would submit a bug report along with code to reproduce (junit test would be optimal).
3. No currently not. Axes are related to traces but there is no 1-1 relationship. If two traces share the same axe…. then which color should the axe have? But if you like you could send a feature request "Allow to specify axis color".
kind regards,
Achim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1/ I use a Trace2DLimited with 60 points. When 60 seconds elapsed, I continue to add one point every second, the oldest point is erased and so on (because I use xAxis1.setRangePolicy(new RangePolicyFixedViewport(new Range(ms1, ms1+60000))); and the new points are over ms1+60000)
So it does'nt work, how can I do that ?
2/ I'll report a bug with code
3/ ok, I understand when 2 two traces share the same axis, buf when they have their own axis, it would be great to change the color.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. Hehe, just don't use the range policy. With the standard one in place you will always have all points shown. If they are limited to 60… that's it. BTW this behavior is shown in the applet : http://jchart2d.sourceforge.net/applet.shtml or the RunningChart demo.
cheers,
Achim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1/ Yes, I looked at the demo and read the source. But I did not like the behavior, so I used the rangePolicy.
If I do not use this, when I add the two first points, they are expanded to fit X axis, and so on. When the buffer is full (60 points) , the trace doesn't expand anymore. It is not beautiful to look at, and the dates in X axis shifted to the left like the trace every time I add a point.
I would like trace does'nt expand and tell the chart to divide the X axis for 4 parts (for instance) which are fixed and the dates in X axis should be different each time I add a new point.
Can I do that ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Achim,
How to Display X-axis labels in HH:MM format, I able to display the X-axis with seconds at regular intervals over a scale of 0 to 86400 secs (i.e. over a full day),
I hope my point is clear, all I need is HH:MM or HH:MM:SS at regular intervals on X-axis time scale over a day, instead of Seconds
Last edit: Abhiram Tripathi 2015-08-20
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
excuse me for my poor english. I'm testing JChart2D and I have some few problems.
1/ I want to visualize a trend where X axis represents time. The X axis must visualize 60 seconds maximum and my points are generated every second. 60 seconds later, the new points are not visible.
I use in my program :
long ms1=System.currentTimeMillis();
xAxis.setRangePolicy(new RangePolicyFixedViewport(new Range(ms1, ms1+60000)));
When the first 60 points are added, how can I do to tell the chart that I want a new range for X axis (ms1+60000,ms1+120000) and so on ?
2/ I only want to visualize only 4 date on X axis (ms1, ms1+20000, ms1+40000, ms1+60000) , and I use
xAxis.setAxisScalePolicy(new AxisScalePolicyManualTicks());
xAxis.setMinorTickSpacing(ms1+20000);
but it doesn't matter, how can I do that ?
3/ I would like to paint Yaxis with trace's color. Can I do that ?
Thanks a lot for your response
Hi Celiner,
1. The viewpoint approach does not work (you had to shift the range everytime you update points… that is clumsy). Instead use a Trace2DLimited as trace and specify the amountOfPoints in the constructor. E.g. in this case: 60.
2. I guess this should work. If not it would be great if you would submit a bug report along with code to reproduce (junit test would be optimal).
3. No currently not. Axes are related to traces but there is no 1-1 relationship. If two traces share the same axe…. then which color should the axe have? But if you like you could send a feature request "Allow to specify axis color".
kind regards,
Achim
Hi Achim,
Thanks for your response.
1/ I use a Trace2DLimited with 60 points. When 60 seconds elapsed, I continue to add one point every second, the oldest point is erased and so on (because I use xAxis1.setRangePolicy(new RangePolicyFixedViewport(new Range(ms1, ms1+60000))); and the new points are over ms1+60000)
So it does'nt work, how can I do that ?
2/ I'll report a bug with code
3/ ok, I understand when 2 two traces share the same axis, buf when they have their own axis, it would be great to change the color.
Hi Celiner,
1. Hehe, just don't use the range policy. With the standard one in place you will always have all points shown. If they are limited to 60… that's it. BTW this behavior is shown in the applet : http://jchart2d.sourceforge.net/applet.shtml or the RunningChart demo.
cheers,
Achim
Hi Achim,
Thanks for your response.
1/ Yes, I looked at the demo and read the source. But I did not like the behavior, so I used the rangePolicy.
If I do not use this, when I add the two first points, they are expanded to fit X axis, and so on. When the buffer is full (60 points) , the trace doesn't expand anymore. It is not beautiful to look at, and the dates in X axis shifted to the left like the trace every time I add a point.
I would like trace does'nt expand and tell the chart to divide the X axis for 4 parts (for instance) which are fixed and the dates in X axis should be different each time I add a new point.
Can I do that ?
Hi Achim,
How to Display X-axis labels in HH:MM format, I able to display the X-axis with seconds at regular intervals over a scale of 0 to 86400 secs (i.e. over a full day),
I hope my point is clear, all I need is HH:MM or HH:MM:SS at regular intervals on X-axis time scale over a day, instead of Seconds
Last edit: Abhiram Tripathi 2015-08-20