Looking for best series option

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
el1179
Newbie
Newbie
Posts: 5
Joined: Fri Jul 12, 2019 12:00 am

Looking for best series option

Post by el1179 » Wed Jun 03, 2020 9:10 pm

I am looking for the best way to represent my data.

What I want is a bar graph report that has 10 bars representing data. Data at these points is updated every second or so, but it is always 10 bars. Over time I want a line or a marker at the minimum value since data pulling started, a line or marker at the maximum value since data pulling. A marker or line at a maximum allowed value and line or marker at a target value.

I have investigated and have it working to some degree with Linear Gauge, but this series does not seem as polished and easy to work with as others and just having 10 in the designer slows down and feels heavy. In the Gauge the maximum is automatic, but the rest has to be done with the redline and greenline and I do not have an option to add two more marks/lines for target and max allowed.

I also am trying stacked bar chart, but this involves a lot of stacked bars and calculations to represent my data.

Are these the best two options? Any suggestions? Thanks.

A bar chart where I can simply add a line or mark at specific value would be ideal.

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

Re: Looking for best series option

Post by Christopher » Tue Jun 09, 2020 9:12 am

Apologies for the delay in our reply to your question.

You're best bet would be to use the Canvas Events - the following is a screenshot from the Feature Demo on GitHub:
TeeChartNetExamples_2020-06-09_10-42-31.png
TeeChartNetExamples_2020-06-09_10-42-31.png (189.19 KiB) Viewed 7186 times
You can use these canvas events to draw anything to the chart - lines, shapes (circles, rectangles) - basically anything TeeChart can draw. To draw something at a specific series value, you can use something like this:

Code: Select all

        private void InitializeChart()
        {
            var bar = new Bar(_tChart.Chart);

            bar.FillSampleValues();

            _tChart.AfterDraw += _tChart_AfterDraw;

            void _tChart_AfterDraw(object sender, Graphics3D g)
            {
                //draw from max to min
                var maxIndex = bar.YValues.IndexOf(bar.YValues.Maximum);
                var minIndex = bar.YValues.IndexOf(bar.YValues.Minimum);

                var minPoint = new Point(bar.CalcXPosValue(bar.XValues[minIndex]), bar.CalcYPosValue(bar.YValues[minIndex]));
                var maxPoint = new Point(bar.CalcXPosValue(bar.XValues[maxIndex]), bar.CalcYPosValue(bar.YValues[maxIndex]));

                g.Pen.Color = Color.Red;
                g.Line(minPoint, maxPoint);
            }
        }
Which here gives me:
TeeChartPro_2020-06-09_11-11-49.png
TeeChartPro_2020-06-09_11-11-49.png (20.15 KiB) Viewed 7186 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