Jump to content
Software FX Community

Databinding to Business Object


User (Legacy)

Recommended Posts

Hi together,

I am not sure how to solve the following issue. I have the following

business object:

public class MyDoubleData

{

private double m_XValue;

private double m_YValue;

public MyDoubleData(double x, double y)

{

m_XValue = x;

m_YValue = y;

}

public double XValue

{

get { return m_XValue; }

set { m_XValue = value; }

}

public double YValue

{

get { return m_YValue; }

set { m_YValue = value; }

}

}

Now I have an ArrayList with multiple MyDoubleData objects:

ArrayList myArray = new ArrayList();

myArray.Add(new MyDoubleData(1.0,3.0);

myArray.Add(new MyDoubleData(2.0,4.0);

myArray.Add(new MyDoubleData(3.0,6.0);

.....

How can I bind this myArray object to the chart (I want a line X/Y plot).

Thanks in advance.

Cheers,

Franz

Link to comment
Share on other sites

The following code will do it:

chart1.DataSourceSettings.Fields.Add(new

FieldMap("XValue",FieldUsage.XValue));

chart1.DataSourceSettings.Fields.Add(new

FieldMap("YValue",FieldUsage.Value));

chart1.DataSource = new

ChartFX.WinForms.DataProviders.ListProvider(myArray);

You need to add a reference to ChartFX.WinForms.Data.dll

--

Francisco Padron

www.chartfx.com

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...