Jump to content
Software FX Community

DataType.NotUsed and DataTables


User (Legacy)

Recommended Posts

I'm attempting to use DataType.NotUsed with a DataTable bound as the

DataSource to selectively plot columns in the DataTable. I can't seem to

limit the chart to plotting only the label and value columns. What am I

doing wrong? In the example code below, I want to plot the first column as

the x-axis and the second column as the only series.

Thanks for your help,

Greg

private void button1_Click(object sender, System.EventArgs e)

{

DataTable myTable = new DataTable("My Table");

myTable.Columns.Add("Time",System.Type.GetType("System.DateTime"));

myTable.Columns.Add("Series 1",System.Type.GetType("System.Double"));

myTable.Columns.Add("Series 2",System.Type.GetType("System.Double"));

myTable.Columns.Add("Series 3",System.Type.GetType("System.Int32"));

myTable.Columns.Add("Series 4",System.Type.GetType("System.Int32"));

Random rdmn = new Random(unchecked((int)DateTime.Now.Ticks));

for (int i = 0; i < 10 ; ++i)

{

myTable.Rows.Add(new object[]

{System.DateTime.Now.Subtract(System.TimeSpan.FromHours(10 + i)),

rdmn.NextDouble() * 100, rdmn.NextDouble() * 100,

rdmn.Next(100), rdmn.Next(100) });

}

myTable.AcceptChanges();

chart1.Gallery = Gallery.Lines;

chart1.DataType[0] = DataType.Label;

chart1.DataType[1] = DataType.Value;

chart1.DataType[2] = DataType.NotUsed;

chart1.DataType[3] = DataType.NotUsed;

chart1.DataSource = myTable;

}

ChartFXLiteProblem.zip

ChartFXLiteProblem.zip

Link to comment
Share on other sites

I'm attempting to use DataType.NotUsed with a DataTable bound as the

DataSource to selectively plot columns in the DataTable. I can't seem to

limit the chart to plotting only the label and value columns. What am I

doing wrong? In the example code below, I want to plot the first column as

the x-axis and the second column as the only series.

Thanks for your help,

Greg

private void button1_Click(object sender, System.EventArgs e)

{

DataTable myTable = new DataTable("My Table");

myTable.Columns.Add("Time",System.Type.GetType("System.DateTime"));

myTable.Columns.Add("Series 1",System.Type.GetType("System.Double"));

myTable.Columns.Add("Series 2",System.Type.GetType("System.Double"));

myTable.Columns.Add("Series 3",System.Type.GetType("System.Int32"));

myTable.Columns.Add("Series 4",System.Type.GetType("System.Int32"));

Random rdmn = new Random(unchecked((int)DateTime.Now.Ticks));

for (int i = 0; i < 10 ; ++i)

{

myTable.Rows.Add(new object[]

{System.DateTime.Now.Subtract(System.TimeSpan.FromHours(10 + i)),

rdmn.NextDouble() * 100, rdmn.NextDouble() * 100,

rdmn.Next(100), rdmn.Next(100) });

}

myTable.AcceptChanges();

chart1.Gallery = Gallery.Lines;

chart1.DataType[0] = DataType.Label;

chart1.DataType[1] = DataType.Value;

chart1.DataType[2] = DataType.NotUsed;

chart1.DataType[3] = DataType.NotUsed;

chart1.DataSource = myTable;

}

Link to comment
Share on other sites

You are doing nothing wrong, this is a bug we introduced in one of our

builds. Our next build will include a fix for this.

--

Regards

JC

Software FX Support

"Greg Sika" <gregsika@cox.net> wrote in message

news:GXKzAfC6BHA.1484@webserver1.softwarefx.com...

> I'm attempting to use DataType.NotUsed with a DataTable bound as the

> DataSource to selectively plot columns in the DataTable. I can't seem to

> limit the chart to plotting only the label and value columns. What am I

> doing wrong? In the example code below, I want to plot the first column

as

> the x-axis and the second column as the only series.

>

> Thanks for your help,

> Greg

>

> private void button1_Click(object sender, System.EventArgs e)

> {

> DataTable myTable = new DataTable("My Table");

> myTable.Columns.Add("Time",System.Type.GetType("System.DateTime"));

> myTable.Columns.Add("Series 1",System.Type.GetType("System.Double"));

> myTable.Columns.Add("Series 2",System.Type.GetType("System.Double"));

> myTable.Columns.Add("Series 3",System.Type.GetType("System.Int32"));

> myTable.Columns.Add("Series 4",System.Type.GetType("System.Int32"));

> Random rdmn = new Random(unchecked((int)DateTime.Now.Ticks));

> for (int i = 0; i < 10 ; ++i)

> {

> myTable.Rows.Add(new object[]

> {System.DateTime.Now.Subtract(System.TimeSpan.FromHours(10 + i)),

> rdmn.NextDouble() * 100, rdmn.NextDouble() * 100,

> rdmn.Next(100), rdmn.Next(100) });

> }

> myTable.AcceptChanges();

> chart1.Gallery = Gallery.Lines;

> chart1.DataType[0] = DataType.Label;

> chart1.DataType[1] = DataType.Value;

> chart1.DataType[2] = DataType.NotUsed;

> chart1.DataType[3] = DataType.NotUsed;

> chart1.DataSource = myTable;

> }

>

>

Link to comment
Share on other sites

You are doing nothing wrong, this is a bug we introduced in one of our

builds. Our next build will include a fix for this.

--

Regards

JC

Software FX Support

"Greg Sika" <gregsika@cox.net> wrote in message

news:GXKzAfC6BHA.1484@webserver1.softwarefx.com...

> I'm attempting to use DataType.NotUsed with a DataTable bound as the

> DataSource to selectively plot columns in the DataTable. I can't seem to

> limit the chart to plotting only the label and value columns. What am I

> doing wrong? In the example code below, I want to plot the first column

as

> the x-axis and the second column as the only series.

>

> Thanks for your help,

> Greg

>

> private void button1_Click(object sender, System.EventArgs e)

> {

> DataTable myTable = new DataTable("My Table");

> myTable.Columns.Add("Time",System.Type.GetType("System.DateTime"));

> myTable.Columns.Add("Series 1",System.Type.GetType("System.Double"));

> myTable.Columns.Add("Series 2",System.Type.GetType("System.Double"));

> myTable.Columns.Add("Series 3",System.Type.GetType("System.Int32"));

> myTable.Columns.Add("Series 4",System.Type.GetType("System.Int32"));

> Random rdmn = new Random(unchecked((int)DateTime.Now.Ticks));

> for (int i = 0; i < 10 ; ++i)

> {

> myTable.Rows.Add(new object[]

> {System.DateTime.Now.Subtract(System.TimeSpan.FromHours(10 + i)),

> rdmn.NextDouble() * 100, rdmn.NextDouble() * 100,

> rdmn.Next(100), rdmn.Next(100) });

> }

> myTable.AcceptChanges();

> chart1.Gallery = Gallery.Lines;

> chart1.DataType[0] = DataType.Label;

> chart1.DataType[1] = DataType.Value;

> chart1.DataType[2] = DataType.NotUsed;

> chart1.DataType[3] = DataType.NotUsed;

> chart1.DataSource = myTable;

> }

>

>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...