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

HTML CHART

1 Answer 82 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Riccardo
Top achievements
Rank 1
Riccardo asked on 25 Jun 2020, 01:03 PM

Hello,

 

I am getting glitches trying to 

connect AdventureWorks2012 db to Telerik UI webapp.

How can I connect some data to a chart?

I m readin the tutorials, but now sure how to synch

then grab data and drop evrything in the chart.

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 30 Jun 2020, 12:15 PM

Hi Riccardo,

In order to bind the chart, you have to configure its data filed-related properties (with the names of te columns holding the data) and set the Datasource / Datasource Id of the control.

For example, in an SqlLDataSource scenario, the chart's declaration can look in a similar way:
https://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/data-binding/sqldatasource

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
    SelectCommand="SELECT [Year], [Value] FROM [Data] WHERE ([Subcategory_Id] = 1)">
</asp:SqlDataSource>
<telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" DataSourceID="SqlDataSource1">
    <PlotArea>
        <Series>
            <telerik:ColumnSeries DataFieldY="Value" Name="Electricity Consumption">
            </telerik:ColumnSeries>
        </Series>
        <XAxis DataLabelsField="Year">
            <LabelsAppearance RotationAngle="75" />
            <TitleAppearance Text="Year" />
        </XAxis>
        <YAxis>
            <TitleAppearance Text="MWh" />
        </YAxis>
    </PlotArea>
    <Legend>
        <Appearance Visible="false" />
    </Legend>
    <ChartTitle Text="Electricity Consumption">
    </ChartTitle>
</telerik:RadHtmlChart>

Regards,
Vessy
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Riccardo
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or