User (Legacy) Posted February 1, 2002 Report Share Posted February 1, 2002 Hello! Please can someone tell me what is wrong with the code below sub FillArray () Dim TotCount Dim DataArray() Dim LegendArray() Set cfxChart1=Server.CreateObject("ChartFX.WebServer") SET cfxArray=Server.CreateObject("cfxData.Array") rs.MoveFirst DO WHILE NOT rs.Eof TotCount=TotCount+1 REDIM Preserve DataArray(TotCount) DataArray(TotCount)=rs("KW") REDIM Preserve LegendArray(TotCount) LegendArray(TotCount)=TotCount rs.MoveNext LOOP rs.Close SET cfxArray=Server.CreateObject("cfxData.Array") cfxArray.AddArray DataArray cfxArray.AddArray LegendArray cfxChart1.GetExternalData cfxArray end sub %> <% Response.write(cfxChart1.GetHtmlTag( "650", "600", "Auto" ))%> All I am trying to do is to fill a chart with a set of numbers obtained from a recordset, using a dynamic array. It is getting very irritating how I can rarely get a feature of ChartFX to work first time, even with the help files. I have even copied the example out of the manual and that does not work either. code above just displays a graph that says No Data Available I know my code creates the dynamic array properly. Any rapid help would be greatly appreciated as I have spent ages trying to get the "easier" parts of ChartFx working and my deadline is rapidly approaching. Cheers Paul Link to comment Share on other sites More sharing options...
Software FX Posted February 1, 2002 Report Share Posted February 1, 2002 The problem here is that you are leaving the first cell of your array empty and then we can not figure out the type of your array elements (because they are mixed). We need to know the types so that we can determine if its going to be used as a label or as a value. Change your code so that you fill the Arrays from position zero (0), which is the first position. The sample code we provide: Set chart = Server.CreateObject("ChartFX.WebServer") ' The samples look better in white chart.RgbBk = RGB(255,255,255) ' Let's use a 2D line chart Chart.ChartType = LINES Chart.Chart3D = False Dim YValue(10) Dim XValue(10) For i = 0 to 9 YValue(i) = i*10 XValue(i) = i*3 Next Set CfxArray = Server.CreateObject("CfxData.Array") CfxArray.AddArray XValue CfxArray.AddArray YValue Chart.DataType(0) = CDT_XVALUE Chart.DataType(1) = CDT_VALUE Chart.GetExternalData CfxArray Works perfectly ! Notice the arrays being filled from zero (0). -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 1, 2002 Author Report Share Posted February 1, 2002 Thanks! "SoftwareFX Support" <support@softwarefx.com> wrote in message news:OzKYUy0qBHA.2636@webserver1.softwarefx.com... > The problem here is that you are leaving the first cell of your array empty > and then we can not figure out the type of your array elements (because they > are mixed). We need to know the types so that we can determine if its going > to be used as a label or as a value. > > Change your code so that you fill the Arrays from position zero (0), which > is the first position. > > The sample code we provide: > > Set chart = Server.CreateObject("ChartFX.WebServer") > > ' The samples look better in white > chart.RgbBk = RGB(255,255,255) > ' Let's use a 2D line chart > Chart.ChartType = LINES > Chart.Chart3D = False > > Dim YValue(10) > Dim XValue(10) > > For i = 0 to 9 > YValue(i) = i*10 > XValue(i) = i*3 > Next > > Set CfxArray = Server.CreateObject("CfxData.Array") > CfxArray.AddArray XValue > CfxArray.AddArray YValue > > Chart.DataType(0) = CDT_XVALUE > Chart.DataType(1) = CDT_VALUE > Chart.GetExternalData CfxArray > > > Works perfectly ! Notice the arrays being filled from zero (0). > > -- > 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.