I'm not sure what I'm doing wrong. I have a very simple circular gauge on a chart. I copied an example to give it a nice look. Here's the code snippet:
TChart chart1;
private CircularGauge gaugeSeries1;
double dHigh = 8000;
double dLow = 0;
chart1.setText("");
chart1.setClipPoints(false);
chart1.getHeader().setVisible(false);
chart1.getLegend().setVisible(false);
chart1.getAspect().setView3D(false);
chart1.getAspect().setSmoothingMode(true);
chart1.getAspect().setTextSmooth(false);
chart1.getWalls().getBack().setTransparency(100);
gaugeSeries1.setMaximum(dHigh);
gaugeSeries1.setMinimum(dLow);
gaugeSeries1.clear();
double diff = dHigh - dLow;
chart1.getAxes().getLeft().setIncrement(diff/10.0);
chart1.getAxes().getLeft().setMinMax(dLow,dHigh);
gaugeSeries1.getFrame().getOuterBand().setColor(Color.fromArgb(153,153,153));
gaugeSeries1.getFrame().getMiddleBand().getGradient().setVisible(true);
gaugeSeries1.getFrame().getMiddleBand().getGradient().setStartColor(Color.fromArgb(80,80,80));
gaugeSeries1.getFrame().getMiddleBand().getGradient().setEndColor(Color.WHITE);
gaugeSeries1.getFrame().getInnerBand().setColor(Color.fromArgb(213,213,213));
gaugeSeries1.setValue(3200);
The gauge is just staying at 0. Not sure why. I also have a general question about how gauge series work. A series usually contains a bunch of data points with X,Y values, but the gauge only displays a Y value since X is time and it always displays the Y at current time. So what does adding data points to the series do? Do you just use setValue to set the gauge value, or are there reasons to add data points to the series? Also how do the chart axes interact with the gauge series? On a line series I set all the min/max and scaling via the chart axes, but on gauge it has setMinimum and setMaximum functions. But the increment seems to still be set via the chart axes property. Are some properties taken from the chart axes and others from the gauge series? This is very confusing to me.
Circular Gauge set value not working
Re: Circular Gauge set value not working
Hello Mark,
For example, I can change it for this:
And I get this, what I'm not sure if it's something similar to what you expected:
It inherits from Series class, and that's why it has the add() methods, the XValues and YValues ValueLists, etc... but they aren't used. Well, only the YValue[0] is used, but it's thought to be modified through the setValue() method.
I hope I've clarified it a little bit. If you still have any doubt, don't hesitate to let us know.
This is what I get with your code: I see the needle at 3200 as set with the setValue call. What I see at 0 are the geen and red lines, but you haven't set them as the rest of the gauges so theay still have the default values, that are 0-70 for the green line and 80-100 for the red line.mts wrote:The gauge is just staying at 0. Not sure why.
For example, I can change it for this:
Code: Select all
gaugeSeries1.setGreenLineEndValue(5600);
gaugeSeries1.setRedLineStartValue(6400);
gaugeSeries1.setRedLineEndValue(8000);
This series is thought to have different values through the time, where the needle indicates the actual value. And the green and red lines just indicate two zones or value intervals.mts wrote:I also have a general question about how gauge series work. A series usually contains a bunch of data points with X,Y values, but the gauge only displays a Y value since X is time and it always displays the Y at current time. So what does adding data points to the series do? Do you just use setValue to set the gauge value, or are there reasons to add data points to the series? Also how do the chart axes interact with the gauge series? On a line series I set all the min/max and scaling via the chart axes, but on gauge it has setMinimum and setMaximum functions. But the increment seems to still be set via the chart axes property. Are some properties taken from the chart axes and others from the gauge series? This is very confusing to me.
It inherits from Series class, and that's why it has the add() methods, the XValues and YValues ValueLists, etc... but they aren't used. Well, only the YValue[0] is used, but it's thought to be modified through the setValue() method.
I hope I've clarified it a little bit. If you still have any doubt, don't hesitate to let us know.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Circular Gauge set value not working
Thanks for the clarification on the series.
It still is not updating however. I have the chart on a panel, which is part of another panel on a scroll pane. I'm making a scrollable view of gauges in a grid format. So the chart is several levels down. I tried explicitly calling gaugeSeries1.repaint() and chart1.repaint() to no avail. Also when I use the regular gauges series over the circular one it updates. It will be difficult to give a better code sample, as it's very dependent on the entire project but I'll try if I can't figure out why this chart won't refresh.
It still is not updating however. I have the chart on a panel, which is part of another panel on a scroll pane. I'm making a scrollable view of gauges in a grid format. So the chart is several levels down. I tried explicitly calling gaugeSeries1.repaint() and chart1.repaint() to no avail. Also when I use the regular gauges series over the circular one it updates. It will be difficult to give a better code sample, as it's very dependent on the entire project but I'll try if I can't figure out why this chart won't refresh.
Re: Circular Gauge set value not working
Ok I got it to work only when I set the limits to 300 or less. I attached three screenshots, one is chart limits of 0-300, another 0-400 and last one my desired 0-8000. All three have the axis increment set at high - low / 10. I also set the green line and red line at 80% and 90-100% of the value as follows:
gaugeSeries1.setGreenLineEndValue(dHigh * .;
gaugeSeries1.setRedLineStartValue(dHigh * .9);
gaugeSeries1.setRedLineEndValue(dHigh);
I set the chart value to 50 for all three charts with:
gaugeSeries1.setValue(50);
The chart 0-300 looks as expected. I get a nice gauge spanning 0-300, increments every 30, the green and red lines look good and my value looks correct. But in all the others it's all wrapped around. You can see in the 0-400 the increments are right but the green and red lines wrap around and the value is approx 70, not the desired 50. This wrap around effect just increases as I set the series limits higher to 500, 600 etc. Then on the 0-8000 chart you can't even see the green/red lines, even though they are set, and the value of 50 doesn't even register. Actually no values register. I am getting no exceptions, just nothing is happening.
Is there some setting not right that is causing my chart to wrap around when it exceeds this 300 limit?
gaugeSeries1.setGreenLineEndValue(dHigh * .;
gaugeSeries1.setRedLineStartValue(dHigh * .9);
gaugeSeries1.setRedLineEndValue(dHigh);
I set the chart value to 50 for all three charts with:
gaugeSeries1.setValue(50);
The chart 0-300 looks as expected. I get a nice gauge spanning 0-300, increments every 30, the green and red lines look good and my value looks correct. But in all the others it's all wrapped around. You can see in the 0-400 the increments are right but the green and red lines wrap around and the value is approx 70, not the desired 50. This wrap around effect just increases as I set the series limits higher to 500, 600 etc. Then on the 0-8000 chart you can't even see the green/red lines, even though they are set, and the value of 50 doesn't even register. Actually no values register. I am getting no exceptions, just nothing is happening.
Is there some setting not right that is causing my chart to wrap around when it exceeds this 300 limit?
- Attachments
-
- chart bad 0-8000.png (38.05 KiB) Viewed 19906 times
-
- chart bad 0-400.png (40.58 KiB) Viewed 19915 times
-
- chart good 0-300.png (39.91 KiB) Viewed 19910 times
Re: Circular Gauge set value not working
Hi Mark,
What TeeChart Java version are you using? It works fine for me both in NetBeans (Swing) and Eclipse (SWT) with v3.2012.0202.
What TeeChart Java version are you using? It works fine for me both in NetBeans (Swing) and Eclipse (SWT) with v3.2012.0202.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Circular Gauge set value not working
I was using a 2011 version, whatever the official release for 2011 was. I tried using the 2011 beta version, as I'm registered for that, but it gave me a bunch of compile errors saying some methods were non existent. Very strange.
However, I downloaded a 2012 evaluation and everything seems to work correctly. So there must have been a bug fix in there somewhere. Thanks for the suggestion, I'm not sure why I didn't try this in the first place.
However, I downloaded a 2012 evaluation and everything seems to work correctly. So there must have been a bug fix in there somewhere. Thanks for the suggestion, I'm not sure why I didn't try this in the first place.
Re: Circular Gauge set value not working
Hi Mark,
Great! I'm glad to hear it!
Great! I'm glad to hear it!
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |