Changing appearance of points in Points series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Ralph
Newbie
Newbie
Posts: 2
Joined: Tue Nov 24, 2020 12:00 am

Changing appearance of points in Points series

Post by Ralph » Mon Nov 30, 2020 1:47 am

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)?

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Changing appearance of points in Points series

Post by Christopher » Mon Nov 30, 2020 9:19 am

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
TeeChartNuGet_2020-11-30_10-14-24.png (27.2 KiB) Viewed 7118 times
TeeChartNuGet_2020-11-30_10-14-28.png
TeeChartNuGet_2020-11-30_10-14-28.png (22.2 KiB) Viewed 7118 times
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply