This is a migrated thread and some comments may be shown as answers.

Pie chart sqldatasource issues

1 Answer 98 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 13 Dec 2017, 06:22 PM

I'm trying to databind the pie chart to the sqldatasource, but it seems there are issues (or I'm not doing it right) with DataFieldY.  The sqldatasource will return 2 column of data as follow:
Description     cnt
7 Days            3
30 Days        37
Rest              42
24 Hour         116

Where the "Description" column I assign to "NameField" and "cnt" column I assign to DataFieldY.  Below is my code for the chart.
                            <telerik:RadHtmlChart runat="server" ID="chartRouters" Width="100%" Height="100%" Transitions="true" 
                                Skin="Silk" DataSourceID="sqlDSModem">
                                <ChartTitle Text="Router Status">
                                    <Appearance Align="Center" Position="Top">
                                        <TextStyle Color="White" />
                                    </Appearance>
                                </ChartTitle>
                                <Legend>
                                    <Appearance Position="Right" Visible="true">
                                    </Appearance>
                                </Legend>
                                <PlotArea>
                                    <Series>
                                        <telerik:PieSeries StartAngle="90" DataFieldY="Cnt" NameField="Description">
                                            <LabelsAppearance Position="OutsideEnd" DataFormatString="{0} %">
                                            </LabelsAppearance>
                                            <TooltipsAppearance Color="White" DataFormatString="{0} %"></TooltipsAppearance>
                                        </telerik:PieSeries>
                                    </Series>
                                </PlotArea>
                            </telerik:RadHtmlChart>   

when I run the code, my pie chart looked "weird" and had only 4 lines (not the chart line, but lines extending out from a single point) Looks almost lilke it is not reading the "cnt" column of the data.  

When I go to the immediate window and do the :

?chartRouters.PlotArea.Series(0).DataFieldY(0)

 

it gave me value of "c" and then DataFieldY(1) is "n" and DataField(2) is "t".  I was expecting to see the actual value when I do that, but it almost like is putting the column field name in the value instead of actual data value?  That is weird.

What is wrong?

thank you!

1 Answer, 1 is accepted

Sort by
0
Frank
Top achievements
Rank 1
answered on 14 Dec 2017, 09:41 PM
never mind I found the issues, the data column name is actually case sensitive....  
Tags
Chart (HTML5)
Asked by
Frank
Top achievements
Rank 1
Answers by
Frank
Top achievements
Rank 1
Share this question
or