Page 1 of 1
Changing appearance of points in Points series
Posted: Mon Nov 30, 2020 1:47 am
by 21089982
I have (many) points in stored in a points series and I also have some custom drawing done connecting some of the points. I now want the ability to switch the points on or off. Using the series.visibility property does not work, because the (auto) X and Y axes extreme values reset to nothing when series is set to invisible, so my custom drawing no longer works. I then tried to change the appearance of the points (e.g. make points width/height =0 or color=transparent) but this only seems to be possible in the Tchart editor? Is it possible to change a the points appearance of a a Points series with code (e.g. the style, colour, widht, etc)?
Re: Changing appearance of points in Points series
Posted: Mon Nov 30, 2020 9:19 am
by Christopher
Hello,
yes, the Points series has a Pointer property which you can use to change the color, style, and width of the Points series pointer. However, to simply make the series invisible without using the Series.Visible property - which means that Axis labels and Legend(s) continue to be rendered - an elegant way is to use the Series.Transparency property, e.g.
Code: Select all
private void InitializeChart(TChart chart)
{
var points = new Points(tChart1.Chart);
void Chart_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
var onepoint = new Point(points.CalcXPos(100), points.CalcYPos(100));
var twopoint = new Point(points.CalcXPos(120), points.CalcYPos(120));
g.Pen.Width = 3;
g.Pen.Color = Color.Red;
g.Line(onepoint, twopoint);
}
chart.AfterDraw += Chart_AfterDraw;
points.FillSampleValues(1000);
chart.Axes.Bottom.SetMinMax(50, 150);
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
tChart1[0].Transparency = checkBox1.Checked ? 0 : 100;
}
- TeeChartNuGet_2020-11-30_10-14-24.png (27.2 KiB) Viewed 7080 times
- TeeChartNuGet_2020-11-30_10-14-28.png (22.2 KiB) Viewed 7080 times