krb875 Posted June 4, 2008 Report Share Posted June 4, 2008 here is some code that itirates through an array double[][]. It adds each seperate index to a series and graphs them. I need a way for each series to start graphing where the last one ended, instead of starting back at 1, or whatever the first point in the scale is. Also can you manipualte the color of the series so that they look the same color? { this.m_Report.chart1.ItemsSource = null; for (int k = 0; k < value.Length; k++) { ChartFX.WPF. SeriesAttributes series = new ChartFX.WPF.SeriesAttributes();List<double> dataPts = new List<double>(); this.m_Report.chart1.AxisX.ScaleUnit = (.05); double Scale = 1 / this.m_Report.chart1.AxisX.ScaleUnit;for (int i = 0; i < value[k].Length; i++) {dataPts.Add(value[k]); } series.ItemsSource = dataPts; this.m_Report.chart1.Series.Add(series); } } Quote Link to comment Share on other sites More sharing options...
krb875 Posted June 4, 2008 Author Report Share Posted June 4, 2008 I changed my code to teh following, it should do what i need it to logically, it compiles but if i try to call ShowDialog, I get a null exceptence error, and it ran fine with the code above. Is there something I need to change if I am trying to use a X and Y point off my List? Or how do i get it to display correctly. Also I still need to be able to change the colors of the series this.m_Report.chart1.ItemsSource = null; this.m_Report.chart1.AxisX.ScaleUnit = (.05);double location = -40; double Scale = 1 / this.m_Report.chart1.AxisX.ScaleUnit;for (int k = 0; k < value.Length; k++) {ChartFX.WPF.SeriesAttributes series = new ChartFX.WPF.SeriesAttributes(); List<ProcessDataSummary.XYMeasure> dataPts = new List<ProcessDataSummary.XYMeasure>();for (int i = 0; i < value[k].Length; i++) {dataPts.Add(new ProcessDataSummary.XYMeasure(location, value[k])); location += Scale; } series.ItemsSource = dataPts; this.m_Report.chart1.Series.Add(series); } } I created an XYMeasure Class of the following: public class XYMeasure { private double m_x; private double m_y;public XYMeasure(double x, double y) { m_x = x; m_y = y; } public double X { get { return m_x; } } public double Y { get { return m_y; } } } Quote Link to comment Share on other sites More sharing options...
krb875 Posted June 4, 2008 Author Report Share Posted June 4, 2008 I changed my code to teh following, it should do what i need it to logically, it compiles but if i try to call ShowDialog, I get a null exceptence error, and it ran fine with the code above. Is there something I need to change if I am trying to use a X and Y point off my List? Or how do i get it to display correctly. Also I still need to be able to change the colors of the series this.m_Report.chart1.ItemsSource = null; this.m_Report.chart1.AxisX.ScaleUnit = (.05);double location = -40; double Scale = 1 / this.m_Report.chart1.AxisX.ScaleUnit;for (int k = 0; k < value.Length; k++) {ChartFX.WPF.SeriesAttributes series = new ChartFX.WPF.SeriesAttributes(); List<ProcessDataSummary.XYMeasure> dataPts = new List<ProcessDataSummary.XYMeasure>();for (int i = 0; i < value[k].Length; i++) {dataPts.Add(new ProcessDataSummary.XYMeasure(location, value[k])); location += Scale; } series.ItemsSource = dataPts; this.m_Report.chart1.Series.Add(series); } } I created an XYMeasure Class of the following: public class XYMeasure { private double m_x; private double m_y;public XYMeasure(double x, double y) { m_x = x; m_y = y; } public double X { get { return m_x; } } public double Y { get { return m_y; } } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.