Hello,
I have a chart, which I will have several lines on with real time data. I have no problem with that portion..
However, I would like to create an 'area' on the chart which will represent 'good' data. This 'area' should go from the left hand side of the chart to the right hand side of the chart.
For example... If the chart had a y-axis from 5.0 to 6.0 and an x-axis of 0.0 to 11.0.
The 'good area' should be a semi-transparent trapezoid which would go from (0,5.1) to (0,5.3) to (11,5.2) to (11,5.4) {represented in (x,y)}
Hope this makes sense..
Thanks!
Andrew
how to 'draw' this on a chart...
Hello,
You can add Map series to your TeeChart. Then programmatically add a Polygon to that series. Something like the following:
You will have to play with the order of your series. The region you want should probably be series(0).
Alex
You can add Map series to your TeeChart. Then programmatically add a Polygon to that series. Something like the following:
Code: Select all
m_PolygonSeries = m_TeeChart.Series(0);
m_PolygonMapSeries = m_PolygonSeries.GetAsMap();
// Add a single polygon to the map series.
long lPolygonIdx = m_PolygonMapSeries.GetShapes().Add();
// There must be only one shape in this series at index 0.
ASSERT(lPolygonIdx == 0);
m_Polygon = m_PolygonMapSeries.GetShapes().GetPolygon(0);
m_Polygon.SetTransparency(33);
m_Polygon.SetColor(RGB(255, 0, 0));
m_Polygon.AddXY(dXMin, dYMin);
m_Polygon.AddXY(dXMax, dYMin);
m_Polygon.AddXY(dXMax, dYMax);
m_Polygon.AddXY(dXMin, dYMax);
Alex
Thanks Alex! That worked perfectly.
Andrew
PS - code was:
With TChart1
.AddSeries scMap
.Series(0).asMap.Shapes.Add
.Series(0).asMap.Shapes.Polygon(0).Transparency = 66
.Series(0).asMap.Shapes.Polygon(0).Color = vbGreen
.Series(0).asMap.Shapes.Polygon(0).AddXY 0, 4.99
.Series(0).asMap.Shapes.Polygon(0).AddXY 11, 5.12
.Series(0).asMap.Shapes.Polygon(0).AddXY 11, 5.23
.Series(0).asMap.Shapes.Polygon(0).AddXY 0, 5.1
.Legend.Visible = False
.Axis.Bottom.Minimum = 0
.Axis.Bottom.Maximum = 11
.Axis.Bottom.Increment = 1
.Axis.Left.Minimum = 4.98
.Axis.Left.Maximum = 5.25
.Axis.Left.Increment = 0.03
End With
End Sub
Andrew
PS - code was:
With TChart1
.AddSeries scMap
.Series(0).asMap.Shapes.Add
.Series(0).asMap.Shapes.Polygon(0).Transparency = 66
.Series(0).asMap.Shapes.Polygon(0).Color = vbGreen
.Series(0).asMap.Shapes.Polygon(0).AddXY 0, 4.99
.Series(0).asMap.Shapes.Polygon(0).AddXY 11, 5.12
.Series(0).asMap.Shapes.Polygon(0).AddXY 11, 5.23
.Series(0).asMap.Shapes.Polygon(0).AddXY 0, 5.1
.Legend.Visible = False
.Axis.Bottom.Minimum = 0
.Axis.Bottom.Maximum = 11
.Axis.Bottom.Increment = 1
.Axis.Left.Minimum = 4.98
.Axis.Left.Maximum = 5.25
.Axis.Left.Increment = 0.03
End With
End Sub