User (Legacy) Posted March 9, 2004 Report Share Posted March 9, 2004 Hi I have a dataset containing the values 1, 700 2, 200 9, 5 The 1, 2 and 9 represents months. I would like to define my x-axis with the values from 1 to 12 and then submit my dataset to the control. The result-grid should still have the values from 1 to 12 but ofcourse only show the data from the dataset (the other months would just have 0 as value) I have searched in the documentation, but have not found it. How do I do this? Thanks! Best regards Soren, Denmark Link to comment Share on other sites More sharing options...
Software FX Posted March 9, 2004 Report Share Posted March 9, 2004 You can do this with an X/Y chart (Lines Scatter, Area, etc.) You can not do it with a bar chart as bar charts use "discrete" data in the X-Axis, in other words the X-Axis in a bar chart is "categorical" meaning that it is just a collection of bars one drawn after another, the position of each bar is determine by its order in this collection. What you can do to achieve your chart is the following: You need use OpenData-CloseData to set up a chart with 12 points. Use COD_ALLOCHIDDEN to initialize these points as hidden values. Then you need to go through your resultset and using the first column as an index, you will set the value of each bar: foreach record index = <value of field one> value = <value of field two> chart.ValueEx(0,index) = value end Notice that this approach requires that there is only one value per month, if there is two, the last one will prevail. -- FP Software FX Link to comment Share on other sites More sharing options...
User (Legacy) Posted March 9, 2004 Author Report Share Posted March 9, 2004 I am not sure I understand (I only have an OpenDataEx and there's no COD_ALLOCHIDDEN) !? I am doing the following: Set chart = Server.CreateObject("ChartFX.WebServer") Chart.RgbBk = RGB(255,255,255) Chart.Gallery = BAR Chart.Chart3D = False Chart.Stacked = CHART_NOSTACKED Chart.Border = False Chart.LegendBox = False Chart.SerLegBox = False Chart.ToolBar = False Chart.TypeMask = 109576194 Chart.DataType(0) = CDT_LABEL Chart.DataType(1) = CDT_VALUE Chart.AdoResultSet rs GetChart = chart.GetHtmlTag(351, 300, "ActiveX") Could you please explain or show by an example how I should create the chart instead to have the 12 points on my x-axis? Thanks for swift answers. Best regards Soren, Denmark "SoftwareFX Support" <noreply@softwarefx.com> wrote in message news:VOsfQVeBEHA.200@webserver3.softwarefx.com... > You can do this with an X/Y chart (Lines Scatter, Area, etc.) You can not do > it with a bar chart as bar charts use "discrete" data in the X-Axis, in > other words the X-Axis in a bar chart is "categorical" meaning that it is > just a collection of bars one drawn after another, the position of each bar > is determine by its order in this collection. > > What you can do to achieve your chart is the following: > > > You need use OpenData-CloseData to set up a chart with 12 points. Use > COD_ALLOCHIDDEN to initialize these points as hidden values. > > Then you need to go through your resultset and using the first column as an > index, you will set the value of each bar: > > foreach record > index = <value of field one> > value = <value of field two> > > chart.ValueEx(0,index) = value > end > > Notice that this approach requires that there is only one value per month, > if there is two, the last one will prevail. > > -- > FP > Software FX > > Link to comment Share on other sites More sharing options...
Software FX Posted March 9, 2004 Report Share Posted March 9, 2004 Instead of: Chart.AdoResultSet rs You need to do: Chart.OpenDataEx COD_VALUES, 1, 12 For i = 0 To 11 Chart.ValueEx (0,i) = CHART_HIDDEN Next Chart.CloseData COD_VALUES This will initialize your chart with 12 "empty" points. Then you need to go through your resultset and do: foreach record index = <value of field one> value = <value of field two> Chart.ValueEx(0,index) = value end -- FP Software FX Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.