Page 1 of 1
creating a chart based on data stored in arrays
Posted: Tue Jan 17, 2012 12:00 pm
by anl1973
Is there any way to create a chart based on data stored in arrays?
I have a quite complex data source for which I need some nested databands to print an appropriate report on the content of the databand. In the AfterPrint event of these databand I collect some metrics in two arrays. The first array contains the different values that appear in the data source and the second array holds the number of ocurrences for each of these values.
Example:
valueArray[0] = "Value1" countArray[0] = 12
valueArray[1] = "Value2" countArray[1] = 8
valueArray[2] = "Value3" countArray[2] = 5
valueArray[3] = "Value4" countArray[3] = 10
...
At the end of the report I would like to have a bar chart where the content of the valueArray represents the "List of Arguments" and the count Array contains the "List of Values" for the chart.
I do understand that there alo might be a way to create the chart from the data source directly, but I fear that this is far too complicated due to the complex data structure of my data source...
Any help highly appreciated. Thx in advance!
Andreas
creating a chart based on data stored in arrays
Posted: Tue Jan 17, 2012 12:24 pm
by anl1973
Just like to add:
Of course, I'm aware that I can set the "List of Arguments" property to "{valueArray[0]};{valueArray[1]};{valueArray[2]};{valueArray[3]}" and the "List of Values" property to "{countArray[0]};{countArray[1]};{countArray[2]};{countArray[3]}", but the main problem is that I don't know the size of the arrays in advance. They may contain 4 elements this time but another time they may contain 7 elements...
creating a chart based on data stored in arrays
Posted: Wed Jan 18, 2012 7:59 am
by Alex K.
Hello,
Please send us your report with test data for analysis.
Thank you.
creating a chart based on data stored in arrays
Posted: Wed Jan 18, 2012 8:45 am
by anl1973
Hi Aleksey,
I will try asap.
But unfortunately I use a special version of your product (integrated into a solution that works together with a requirements management solution called IRQA from Visure Solutions). So, the data source is an IRQA repository stored in MS Access. The way data is extracted from that data source is probably special to IRQA, so sending my current example together with the MS Access DB will not make much sense because you would probably need the IRQA tool itself, too.
But I will try to setup a similar (probably much easier) example using the trial version of StimulsoftReports.Net_2011.3 which I just downloaded.
Hang on...
BR, Andreas
creating a chart based on data stored in arrays
Posted: Wed Jan 18, 2012 4:31 pm
by anl1973
Hi Aleksey,
attached you will find the simplified example (based on data stored in the attached csv-file). If you run the report you will be asked for a "test data set". If you chose "testset1" you will get some data with only two different argument values ("x1" and "x2"). On the databand you will find some code in the BeforePrint event where I compose the two array. For "testset1" you will get valueArray = { "x1" , "x2" } and countArray = { 5 , 2 }. The chart - configured to use the arguments "{valueArray[0]};{valueArray[1]}" and values "{countArray[0]};{countArray[1]}" - is fine!
Now run the report again but chose "testset2" this time. Now you will get other data from the data source with 4 different argument values ("Value1", "Value2", "Value3" and "Value4"). Thus you will get array with 4 elements each. The chart still takes only the first two according to the define List of Arguments and List of Value. But, of course I would like to see 4 bars in this case...
Hope, it is clear what I want to achieve...
Thx in advance for your help.
BR,
Andreas
creating a chart based on data stored in arrays
Posted: Thu Jan 19, 2012 4:52 am
by Alex K.
Hello,
In this case, you can use a simple method - additional datasource "Data from other datasource"
Please see the modified report in attachment.
Thank you.
creating a chart based on data stored in arrays
Posted: Thu Jan 19, 2012 5:32 pm
by anl1973
Hi Aleksey,
many thanks for the example. If I understood it right you create "DataSource2" directly from "DataSource1". Looks quite simple if you have a simple structure in the initial data source. But I'm not really sure if I will be able to do the same with the more complex IRQA data source structure... Will try tomorrow...
Andreas
creating a chart based on data stored in arrays
Posted: Fri Jan 20, 2012 3:14 am
by Alex K.
Hello,
Ok.
Let us know if you need any additional help.
Thank you.