Jump to content
Software FX Community

A Question about NSeries


Recommended Posts

Hi, Frank

In an application we are developing under VS 2003 and with ChartFX Client 5.1, I try to put three series in a chart, so in the Chart property window, I put 3 in the NSeries field. And I used the following three sections of code trying to draw in each of the three series. In the design mode I can see all the three series as are expected, but at run time only first two series show up. And the worst thing is that when it is trying to draw the third series, an error message pops up "Exception from HRESULT: 0x800A17D (CTL_E_INVALIDPROPERTYARRAYINDEX)". I put two check points over there, and I know it must be something wrong with chartScour.Series[2], but I did define NSeries is 3. Please help to find that culprit. :(

private void DrawPitDimension()

{

  int i = 0;

  int count = 0;

  PitPoints pitPoints =

new PitPoints();

  pitPoints = GetPitPoints();

  count = pitPoints.X.GetLength(0);

  // Draw the pit dimension (6 pints of the pit)

chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_XVALUES, 2, count);

chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_VALUES, 2, count);

for (i=0; i<count; i++)

{

  chartScour.Series[0].set_Xvalue(i, pitPoints.X);

  chartScour.Series[0].set_Yvalue(i, pitPoints.Y);

}

chartScour.CloseData(ChartfxLib.CfxCod.COD_XVALUES);

chartScour.CloseData(ChartfxLib.CfxCod.COD_VALUES);

}

 

private void DrawHeadCut(){

  int i = 0;

  int count = 0;

  ScourPoints headcut =

new ScourPoints();

  headcut = GetHeadcutPoints();

  count = headcut.X.GetLength(0);

  chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_XVALUES, 2, count);

  chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_VALUES, 2, count);

  for (i=0; i<count; i++)

  {

chartScour.Series[1].set_Xvalue(i, headcut.X);

chartScour.Series[1].set_Yvalue(i, headcut.Y);

  }

  chartScour.CloseData(ChartfxLib.CfxCod.COD_XVALUES);

  chartScour.CloseData(ChartfxLib.CfxCod.COD_VALUES);

}

private void DrawTailCut()

{

  int i = 0;

  int count = 0;

  ScourPoints tailcut =

new ScourPoints();

  tailcut = GetTailcutPoints();

  count = tailcut.X.GetLength(0);

  chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_XVALUES, 2, count);

  chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_VALUES, 2, count);

  MessageBox.Show("Spot A OK");

  for (i=0; i<count; i++)

  {

chartScour.Series[2].set_Xvalue(i, tailcut.X);

chartScour.Series[2].set_Yvalue(i, tailcut.Y);

  }

  MessageBox.Show("Spot B OK");

  chartScour.CloseData(ChartfxLib.CfxCod.COD_XVALUES);

  chartScour.CloseData(ChartfxLib.CfxCod.COD_VALUES);

}

Link to post
Share on other sites

Frank

There is one more module which is related to this, and hope the problem is not coming from this module.

private void SetSeries()

{

//Initialization of the Series object setting

//(series 0 for pit, series 1 for headcut, and series 2 for tailcut)

chartScour.Series[0].Gallery = ChartfxLib.CfxGallery.LINES;

chartScour.Series[0].Border = true;

chartScour.Series[0].LineWidth = 1;

chartScour.Series[0].LineStyle = ChartfxLib.CfxLineStyle.CHART_SOLID;

chartScour.Series[0].Volume = 75;

chartScour.Series[0].Legend = "Pit Dimension";

chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_COLORS, 4, 0);

chartScour.Series[0].BorderColor = 0x000000;

chartScour.Series[0].Color = 0x003399;

chartScour.CloseData(ChartfxLib.CfxCod.COD_COLORS);

chartScour.Series[1].Gallery = ChartfxLib.CfxGallery.CURVE;

chartScour.Series[1].Border = true;

chartScour.Series[1].LineWidth = 2;

chartScour.Series[1].LineStyle = ChartfxLib.CfxLineStyle.CHART_SOLID;

chartScour.Series[1].Volume = 75;

chartScour.Series[1].Legend = "Headcut";

chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_COLORS, 4, 0);

chartScour.Series[1].BorderColor = 0xFFFF00;

chartScour.Series[1].Color = 0xFFFF99;

chartScour.CloseData(ChartfxLib.CfxCod.COD_COLORS);

 

chartScour.Series[2].Gallery = ChartfxLib.CfxGallery.CURVE;

chartScour.Series[2].Border = true;

chartScour.Series[2].LineWidth = 2;

chartScour.Series[2].LineStyle = ChartfxLib.CfxLineStyle.CHART_SOLID;

chartScour.Series[2].Volume = 75;

chartScour.Series[2].Legend = "Tailcut";

chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_COLORS, 4, 0);

chartScour.Series[2].BorderColor = 0xFFFF00;

chartScour.Series[2].Color = 0xFFFF99;

chartScour.CloseData(ChartfxLib.CfxCod.COD_COLORS);

}

 
Link to post
Share on other sites

chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_VALUES, 2, count);

Is defining TWO (2) series. Change it to:

 chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_VALUES, 2, count);

Frank, you mean, change to chartScour.OpenDataEx(ChartfxLib.CfxCod.COD_VALUES, 3, count);, right?

Thanks, it is working fine now!

Link to post
Share on other sites

Hi, Frank

Here comes another annoying problem. When I run this app un VS 2003 IDE, everything is fine, including the ChartFX.

But when I deploy this and install it in either my own machine or another testing machine, and when I try to open the chart, I got the following message.

 Posted Image"An unhandled exception has occurred in you application. If you click Contiune, the application will ignore this error and attempt to contiune. If you click Quit, the application will be shut down immediately"

"Exceptoion form HRESULT: 0x800A017D (CTL_EINVALIDARRAYINDEX)."

After I click the Details button I see that the error is started from my SetSeries module.

 Any idea what might be the culprit? Thanks

Link to post
Share on other sites

Frank

I did check several times of my deploy package, and even re-registered all dlls. But still no luck.

When the Exception message pops up, I clicked the Details button, and find something that might be caused by ChartFX. Oops :-(

The following is the detail message I saw from the Exception

*********** Exception Text ***********************

System.Runtime.InteropServices.COMException (0x800A017D): Exception from HRESULT: 0X800A017D(CTL_E_INVALIDPROPERTYARRAYINDEX )

at ChartfxLib.ICfxSeriesEnum.get_Item(Int16 index)

at PitScour102.frmGraphics.frmGraphics_Load(Object sender, EvenetArgs e)

at System.Windows.Forms.Form.OnLoad(EventArgs e)

................

I opened the Object Browser window from the VS IDE to browse the interop.chartfxlib object, and found out that under ICfxSeriesEnum interface, there are only two properties, "Count"  and "this[short]", but no get_Item method. Is this method defined somewhere else? Just curiorious to know, or probably that is why I did not get it right. Please give a reply. Thanks.

Link to post
Share on other sites
  • 2 weeks later...

Please try setting the data using chart.ValueEx and chart.YValueEx to pass the data between OpenData/CloseData. We delay most of the extra allocations up to the CloseData call, so accessing per-series data should only be done after CloseData.

JuanC

Link to post
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.

Loading...
×
×
  • Create New...