Circular Gauge set value not working
Posted: Mon Jun 04, 2012 12:49 pm
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.
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.