creating a chart based on data stored in arrays

Stimulsoft Reports.NET discussion
Post Reply
anl1973
Posts: 13
Joined: Tue Jan 17, 2012 11:43 am
Location: Wolfsburg, Germany

creating a chart based on data stored in arrays

Post 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


anl1973
Posts: 13
Joined: Tue Jan 17, 2012 11:43 am
Location: Wolfsburg, Germany

creating a chart based on data stored in arrays

Post 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...
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

creating a chart based on data stored in arrays

Post by Alex K. »

Hello,

Please send us your report with test data for analysis.

Thank you.
anl1973
Posts: 13
Joined: Tue Jan 17, 2012 11:43 am
Location: Wolfsburg, Germany

creating a chart based on data stored in arrays

Post 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
anl1973
Posts: 13
Joined: Tue Jan 17, 2012 11:43 am
Location: Wolfsburg, Germany

creating a chart based on data stored in arrays

Post 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
Attachments
1569.testData1.csv
(299 Bytes) Downloaded 309 times
1568.Report.mrt
(19.56 KiB) Downloaded 470 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

creating a chart based on data stored in arrays

Post 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.
Attachments
1570.Report_modified.mrt
(19.5 KiB) Downloaded 498 times
anl1973
Posts: 13
Joined: Tue Jan 17, 2012 11:43 am
Location: Wolfsburg, Germany

creating a chart based on data stored in arrays

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

creating a chart based on data stored in arrays

Post by Alex K. »

Hello,

Ok.
Let us know if you need any additional help.

Thank you.
Post Reply