Pure client side

2 posts, 0 answers
  1. Henrik
    Henrik avatar
    23 posts
    Member since:
    Feb 2012

    Posted 01 Feb 2014 Link to this post

    Hi.

    I cant seem to figure this out:
    I want to use the HTMLchare pure client-sided.

    My data looks like this :
    var qData = [{"QNum": 1,"Result": 2},{"QNum": 2,"Result": 2},{"QNum": 3,"Result": 3},{"QNum": 4,"Result": 3},{"QNum": 5,"Result": 4},{"QNum": 6,"Result": 1}];

    My chart is configured like this :

                    <telerik:RadHtmlChart ID="RadHtmlChart1" runat="server"
                        Width="800px" InvokeLoadData="FromCode">
    <ChartTitle>
    <Appearance Visible="False">
    </Appearance>
    </ChartTitle>

                        <Legend>
                            <Appearance Visible="False">
                            </Appearance>
                        </Legend>
                        <PlotArea>
    <XAxis Step="1" Visible="True" DataLabelsField="QNum" >

    </XAxis>

    <YAxis MaxValue="4" MinValue="0" Visible="True"   >

    </YAxis>
                            <Series>
                                <telerik:ColumnSeries Name="Result" DataFieldY="Result" >
                                                                   <Appearance>
                                            <FillStyle BackgroundColor="#d5a2bb"></FillStyle>
                                       </Appearance>
                                </telerik:ColumnSeries>
                            </Series>
                        </PlotArea>
                        <Navigator>
                            <XAxis Visible="True">
                            </XAxis>
                        </Navigator>
            </telerik:RadHtmlChart>

    And i try to bind it like this:

                        function CheckboxClicked(sender) {
                            var RadHtmlChart1 = $find('<%=RadHtmlChart1.ClientID %>');
                            RadHtmlChart1.set_dataSource(qData);

                            //Redrawing the chart
                            RadHtmlChart1.repaint();
                        }


    Now, when I repaint, it does create 6 labels on the XAxis and naming them according to the QNum column in my data but the values of the columns are not populated according to the "Result" column in my data.

    What am I missing?
  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 04 Feb 2014 Link to this post

    Hello Henrik,

    Setting the InvokeLoadData property to "FromCode" is required in scenarios where the chart's data source is to be loaded via a callback. Since the data source binding is performed entirely on the client it is not required for this property to be set. You can also find a runnable sample of the provided VS example in the attached archive.

    Regards,
    Danail Vasilev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top