Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
Data Binding to SQL
posted

I didn't see any examples of using a data set from a database for the X/Y of a series. I have a dataset that will have 2 columns, ErrorDate and ErrorCount. I want the ErrorDate data to be the X axis data points, and the ErrorCount to be the Y axis values. Do you have any examples of how to do this? I will also be adding additional chart series' to the same chart, which will all have the same column format. All the examples I've seen seem to use a pivoted data set, which won't work for me.

Thanks.

Dan

  • 170
    Verified Answer
    posted

    This is from the handler for event Window.Loaded. It works for me.

                Series series1 = new Series();
                series1.ChartType = ChartType.ScatterLine;
                series1.DataSource = this.theTable;
                series1.DataMapping = "ValueX = timeStamp; ValueY = val1";
                series1.Label = "val1";
                this.xamChart1.Series.Add(series1);

                Series series2 = new Series();
                series2.ChartType = ChartType.ScatterLine;
                series2.DataSource = this.theTable;
                series2.DataMapping = "ValueX = timeStamp; ValueY = val2";
                series2.Label = "val2";
                this.xamChart1.Series.Add(series2);

    Bill