Hi,
I need to create a pie chart that is based on pavement condition data. The datasource is a dynamically filled data table that
I am not able to modify. If this were a SQL Based datasource the task would be fairly easy, but it isn't so I'm stuck looking for
an alternate solution. There is a column on the datasource I have that contains an integer score ranging from 0 to 100. The
scores need to be "classified" into the following categories
Poor <= 40
Fair > 40 AND <= 60
Good > 60 AND <= 80
Excellent > 80
For each category I need the sum of another field that contains the length of road segments. The pie chart should display
for each category the sum of road segment lengths. To test this, I added the following to the list of arguments for the
report... Poor;Fair. I tried adding the following to the list of values... {SumIf(GISAttributes.LANE_MILE,GISAttributes.OCI <= 40)};{SumIf(GISAttributes.LANE_MILE,GISAttributes.OCI > 40 && GISAttributes.OCI <= 60)}, but that throws a "The name 'SumIf' does not exist in the current context"
error.
I then tried creating two integer variables to store the values and put the following in the BeforePrint event of the chart (I also tried putting the expressions
in the BeginRender event of the Chart).
var1 = (int)SumIf(GISAttributes.LANE_MILE,GISAttributes.OCI <= 40);
var2 = (int)SumIf(GISAttributes.LANE_MILE,GISAttributes.OCI > 40 && GISAttributes.OCI <= 60);
I don't get any errors with this approach, but I also don't get anything showing up in the chart because the values of var1 & var2 both equal 0.
Can you suggest an approach for doing what I'm trying - if it is even possible?
Thanks,
Carl
Setting list of values for a pie chart
Re: Setting list of values for a pie chart
Hi Carl,
Please try to use the 'data from other datasource' to get the aggregated values with some calculated columns.
https://www.stimulsoft.com/en/documenta ... source.htm
If this approach does not work, could you please attach a sample report template and data for the report, so we would try to find an alternative approach?
Thank you,
Edward
Please try to use the 'data from other datasource' to get the aggregated values with some calculated columns.
https://www.stimulsoft.com/en/documenta ... source.htm
If this approach does not work, could you please attach a sample report template and data for the report, so we would try to find an alternative approach?
Thank you,
Edward
Re: Setting list of values for a pie chart
Thanks Edward,
I did end up using the data from other datasource option along with a "custom table" containing each possible score & their category as listed below...
select 1 as score, 'Poor' as Condition, 'Red' as Color
Union
select 2 as score, 'Poor' as Condition, 'Red' as Color
Union
select 3 as score, 'Poor' as Condition, 'Red' as Color
...
Union
select 41 as score, 'Fair' as Condition, 'Yellow' as Color
Union
select 42 as score, 'Fair' as Condition, 'Yellow' as Color
...
Union
select 63 as score, 'Good' as Condition, 'Green' as Color
Union
select 64 as score, 'Good' as Condition, 'Green' as Color
...
Union
select 99 as score, 'Excellent' as Condition, 'Blue' as Color
Union
select 100 as score, 'Excellent' as Condition, 'Blue' as Color
I related my custom table to the DataTable based on the score and then created a new datasource using the data from other datasource as you suggested.
The color column was used in the AutoSeriesColorColumn.
Thanks for the help!
Cheers,
Carl
I did end up using the data from other datasource option along with a "custom table" containing each possible score & their category as listed below...
select 1 as score, 'Poor' as Condition, 'Red' as Color
Union
select 2 as score, 'Poor' as Condition, 'Red' as Color
Union
select 3 as score, 'Poor' as Condition, 'Red' as Color
...
Union
select 41 as score, 'Fair' as Condition, 'Yellow' as Color
Union
select 42 as score, 'Fair' as Condition, 'Yellow' as Color
...
Union
select 63 as score, 'Good' as Condition, 'Green' as Color
Union
select 64 as score, 'Good' as Condition, 'Green' as Color
...
Union
select 99 as score, 'Excellent' as Condition, 'Blue' as Color
Union
select 100 as score, 'Excellent' as Condition, 'Blue' as Color
I related my custom table to the DataTable based on the score and then created a new datasource using the data from other datasource as you suggested.
The color column was used in the AutoSeriesColorColumn.
Thanks for the help!
Cheers,
Carl
Re: Setting list of values for a pie chart
Hi Carl,
No problem
Glad that the solution has been found!
Thank you for explaining your approach, which did the trick and worked.
Kind Regards,
Edward
No problem

Thank you for explaining your approach, which did the trick and worked.
Kind Regards,
Edward