User (Legacy) Posted January 31, 2002 Report Share Posted January 31, 2002 I'd like to add data to a graph in one second intervals (for example.) I want the chart to develop as the data is added. So, after 5 seconds, 5 points will be visible. With the code below, I get no updates for 10 seconds, then all the data appears. private void btnDataSet_Click(object sender, System.EventArgs e) { int i; chart1.Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines; // Set X/Y data for (i = 0; i<10 ; i++) { chart1.OpenData(SoftwareFX.ChartFX.Lite.COD.Values , 2, 10); chart1.Value[0, i] = (20 + i); chart1.Value[1, i] = (40 + i); chart1.Legend[i] = (i + 1).ToString(); chart1.CloseData(SoftwareFX.ChartFX.Lite.COD.Values); Thread.Sleep(1000); } chart1.AxisX.Grid = true; // Format Primary Y-Axis chart1.SerLeg[0] = "Series #1"; chart1.SerLeg[1] = "Series #2"; // Format X-Axis } I have tried to change the OpenData call as follows chart1.OpenData(SoftwareFX.ChartFX.Lite.COD.Values , 2, SoftwareFX.ChartFX.Lite.COD.Unknown); but it generates the following compile time error: Argument '3': cannot convert from 'SoftwareFX.ChartFX.Lite.COD' to 'int' Do you have any suggestions on how to do this? Is it possible? Thanks, Steve Link to comment Share on other sites More sharing options...
User (Legacy) Posted January 31, 2002 Author Report Share Posted January 31, 2002 I'd like to add data to a graph in one second intervals (for example.) I want the chart to develop as the data is added. So, after 5 seconds, 5 points will be visible. With the code below, I get no updates for 10 seconds, then all the data appears. private void btnDataSet_Click(object sender, System.EventArgs e) { int i; chart1.Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines; // Set X/Y data for (i = 0; i<10 ; i++) { chart1.OpenData(SoftwareFX.ChartFX.Lite.COD.Values , 2, 10); chart1.Value[0, i] = (20 + i); chart1.Value[1, i] = (40 + i); chart1.Legend[i] = (i + 1).ToString(); chart1.CloseData(SoftwareFX.ChartFX.Lite.COD.Values); Thread.Sleep(1000); } chart1.AxisX.Grid = true; // Format Primary Y-Axis chart1.SerLeg[0] = "Series #1"; chart1.SerLeg[1] = "Series #2"; // Format X-Axis } I have tried to change the OpenData call as follows chart1.OpenData(SoftwareFX.ChartFX.Lite.COD.Values , 2, SoftwareFX.ChartFX.Lite.COD.Unknown); but it generates the following compile time error: Argument '3': cannot convert from 'SoftwareFX.ChartFX.Lite.COD' to 'int' Do you have any suggestions on how to do this? Is it possible? Thanks, Steve Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 1, 2002 Author Report Share Posted February 1, 2002 Try converting your values to a float or real before you pass it to the chart. Tim Barton, MCSD "xrx" <f7el4ri9@hotmail.com> wrote in message news:7GBIsEqqBHA.2644@webserver1.softwarefx.com... I'd like to add data to a graph in one second intervals (for example.) I want the chart to develop as the data is added. So, after 5 seconds, 5 points will be visible. With the code below, I get no updates for 10 seconds, then all the data appears. private void btnDataSet_Click(object sender, System.EventArgs e) { int i; chart1.Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines; // Set X/Y data for (i = 0; i<10 ; i++) { chart1.OpenData(SoftwareFX.ChartFX.Lite.COD.Values , 2, 10); chart1.Value[0, i] = (20 + i); chart1.Value[1, i] = (40 + i); chart1.Legend[i] = (i + 1).ToString(); chart1.CloseData(SoftwareFX.ChartFX.Lite.COD.Values); Thread.Sleep(1000); } chart1.AxisX.Grid = true; // Format Primary Y-Axis chart1.SerLeg[0] = "Series #1"; chart1.SerLeg[1] = "Series #2"; // Format X-Axis } I have tried to change the OpenData call as follows chart1.OpenData(SoftwareFX.ChartFX.Lite.COD.Values , 2, SoftwareFX.ChartFX.Lite.COD.Unknown); but it generates the following compile time error: Argument '3': cannot convert from 'SoftwareFX.ChartFX.Lite.COD' to 'int' Do you have any suggestions on how to do this? Is it possible? Thanks, Steve Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 1, 2002 Author Report Share Posted February 1, 2002 Try converting your values to a float or real before you pass it to the chart. Tim Barton, MCSD "xrx" <f7el4ri9@hotmail.com> wrote in message news:7GBIsEqqBHA.2644@webserver1.softwarefx.com... I'd like to add data to a graph in one second intervals (for example.) I want the chart to develop as the data is added. So, after 5 seconds, 5 points will be visible. With the code below, I get no updates for 10 seconds, then all the data appears. private void btnDataSet_Click(object sender, System.EventArgs e) { int i; chart1.Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines; // Set X/Y data for (i = 0; i<10 ; i++) { chart1.OpenData(SoftwareFX.ChartFX.Lite.COD.Values , 2, 10); chart1.Value[0, i] = (20 + i); chart1.Value[1, i] = (40 + i); chart1.Legend[i] = (i + 1).ToString(); chart1.CloseData(SoftwareFX.ChartFX.Lite.COD.Values); Thread.Sleep(1000); } chart1.AxisX.Grid = true; // Format Primary Y-Axis chart1.SerLeg[0] = "Series #1"; chart1.SerLeg[1] = "Series #2"; // Format X-Axis } I have tried to change the OpenData call as follows chart1.OpenData(SoftwareFX.ChartFX.Lite.COD.Values , 2, SoftwareFX.ChartFX.Lite.COD.Unknown); but it generates the following compile time error: Argument '3': cannot convert from 'SoftwareFX.ChartFX.Lite.COD' to 'int' Do you have any suggestions on how to do this? Is it possible? Thanks, Steve Link to comment Share on other sites More sharing options...
Software FX Posted February 1, 2002 Report Share Posted February 1, 2002 You are "hanging" the thread that contains the chart when you make the call to sleep(). I'm not sure what you want to do but if you want to refresh the chart every 10 seconds, you have to create a timer that refreshes the chart, you can not put your process to sleep, the chart (and any other control you create) is part of your thread and therefore when you call sleep() you are not going to be receiving any Paint messages (or any other messages such as mouse, keyboard, etc.). -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
Software FX Posted February 1, 2002 Report Share Posted February 1, 2002 You are "hanging" the thread that contains the chart when you make the call to sleep(). I'm not sure what you want to do but if you want to refresh the chart every 10 seconds, you have to create a timer that refreshes the chart, you can not put your process to sleep, the chart (and any other control you create) is part of your thread and therefore when you call sleep() you are not going to be receiving any Paint messages (or any other messages such as mouse, keyboard, etc.). -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.