Jump to content
Software FX Community

Help with setting X Scale on Graph, as well as series color options


krb875

Recommended Posts

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

 

}

}

Link to comment
Share on other sites

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; }

}

}

 

Link to comment
Share on other sites

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; }

}

}

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...