Chart displays 2 series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
seth
Newbie
Newbie
Posts: 3
Joined: Tue Oct 27, 2009 12:00 am

Chart displays 2 series

Post by seth » Wed Aug 10, 2011 6:13 am

Support,

I'm currently using TeeChart WPF.

I've created a chart and set the following properties for the chart:

Code: Select all

            this.chart.Aspect.View3D = false;
            this.chart.Legend.CheckBoxes = true;
            this.chart.Legend.Alignment = LegendAlignments.Top;
            this.chart.Header.Visible = false;
Additionally, I have another method that adds the series for me:

Code: Select all

        public void AddSeries(double[] xValues, double[] yValues)
        {
            //var line = new Steema.TeeChart.WPF.Styles.Line();
            var line = new Steema.TeeChart.WPF.Styles.Points();
            line.Add(xValues, yValues);
            chart.Series.Add(line);
         }
I keep getting two series, one of them is correct i.e. as per added data. However, the other highlighted in the red box below is invalid. I just want the one series as per the added data. What am I doing wrong?

Image

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Chart displays 2 series

Post by Sandra » Wed Aug 10, 2011 3:44 pm

Hello seth,
I couldn't reproduce your problem using last version and next code:

Code: Select all

        public MainWindow()
        {
            InitializeComponent();
            InitializeChart();
        }
        double[] xValues, yValues;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            tChart1.Legend.CheckBoxes = true;
            tChart1.Legend.Alignment = LegendAlignments.Top;
            tChart1.Header.Visible = false;
            Random rnd = new Random();
            for (int i = 0; i < 2; i++)
            {
                xValues = new double[10];
                yValues = new double[10];
                for (int j = 0; j < 10; j++)
                {
                    xValues[j] = j;
                    yValues[j] = rnd.Next(100);

                }
                AddSeries(xValues,yValues);
            }
        }
        public void AddSeries(double[] xValues, double[] yValues)
        {
            var line = new Steema.TeeChart.WPF.Styles.Points();
            line.Add(xValues, yValues);
           tChart1.Series.Add(line);
        }
Please, check if previous code works fine for you. If works fine, could you try to modify it, so we can reproduce exactly your problem?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

seth
Newbie
Newbie
Posts: 3
Joined: Tue Oct 27, 2009 12:00 am

Re: Chart displays 2 series

Post by seth » Thu Aug 11, 2011 1:11 am

Hi Sandra,

Thanks for following up. I realise now, the problem is on my end, the data set in question actually contains only the 1 series and somewhere along the way some values are becoming zero. This does not happen at the teechart level. Thanks for you time.

Seth

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Chart displays 2 series

Post by Sandra » Thu Aug 11, 2011 8:19 am

Hello Seth,

I am glad that you can find a solution for our problem :)

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply