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

Line Chart Series from Data?

5 Answers 100 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 2
Aaron asked on 22 Jul 2010, 09:14 PM
I'm trying to create a line chart that appears similar to the following screenshot, which I did in Excel. 

Basically, as you can see, the first column contains the location ID.  For each unique Location ID, the chart should generate a new series.  The data for that series then appears in column 2 (date) and column 3 (tempurature).

Is there anyway to do this with Rad Chart?

Thanks.

Aaron

5 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 27 Jul 2010, 08:58 AM
Hello Aaron,

One possible option to handle this setup would be to use two line series, one for each data group. This is demonstrated in the screenshot attached to this message.
You can plot the data declaratively:

<Series>
                           <telerik:ChartSeries Name="Series 1" Type="Line">                           
                               <Items>
                                   <telerik:ChartSeriesItem YValue="63" Name="Item 1">
                                   </telerik:ChartSeriesItem>
                                   <telerik:ChartSeriesItem YValue="45" Name="Item 2">
                                   </telerik:ChartSeriesItem>
                                   <telerik:ChartSeriesItem YValue="66" Name="Item 3">
                                   </telerik:ChartSeriesItem>
                                   <telerik:ChartSeriesItem YValue="78" Name="Item 4">
                                   </telerik:ChartSeriesItem>
                                   <telerik:ChartSeriesItem YValue="34" Name="Item 5">
                                   </telerik:ChartSeriesItem>
                               </Items>
                           </telerik:ChartSeries>
                           <telerik:ChartSeries Name="Series 1" Type="Line">                           
                               <Items>
                                   <telerik:ChartSeriesItem YValue="23" Name="Item 1">
                                   </telerik:ChartSeriesItem>
                                   <telerik:ChartSeriesItem YValue="67" Name="Item 2">
                                   </telerik:ChartSeriesItem>
                                   <telerik:ChartSeriesItem YValue="89" Name="Item 3">
                                   </telerik:ChartSeriesItem>
                                   <telerik:ChartSeriesItem YValue="56" Name="Item 4">
                                   </telerik:ChartSeriesItem>
                                   <telerik:ChartSeriesItem YValue="37" Name="Item 5">
                                   </telerik:ChartSeriesItem>
                               </Items>
                           </telerik:ChartSeries>
                       </Series>

or use a datasource to populate the data:

http://www.telerik.com/help/aspnet-ajax/buildingdatabinddatabase.html

I hope this information gets you started properly.

Greetings,
Yavor
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Aaron
Top achievements
Rank 2
answered on 27 Jul 2010, 07:52 PM
Thanks, Yavor, for the reply.

I do get how I would go about adding series to the graph programmatically.  What I don't get, and what isn't apparent from the tutorial you sent me the link to, is how I can tell RadChart how to add the series automatically from distinct values in a particular column, in this case Location. 

Thanks.

Aaron
0
Yavor
Telerik team
answered on 28 Jul 2010, 06:42 AM
Hello Aaron,

In order to ensure the proper mapping between the data and the series, you can add a series for each data field, as in the example suggested earlier:

RadChart1.Series[0].DataYColumn = "TotalSales";
           RadChart1.PlotArea.XAxis.DataLabelsColumn = "CategoryName";
           // assign appearance related properties
           RadChart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 300;
           RadChart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color =
           System.Drawing.Color.BlueViolet;
           RadChart1.PlotArea.Appearance.Dimensions.Margins.Bottom =
           Telerik.Charting.Styles.Unit.Percentage(30);
           // bind to the datasource
           RadChart1.DataBind();

Let me know how this approach meets your requirements.

All the best,
Yavor
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Aaron
Top achievements
Rank 2
answered on 03 Aug 2010, 05:04 PM
Hi Yavor,

Thanks again for all of your help.

I actually don't want to add a series for multiple columns.  All my series come from one column. 

I want the series to come from the distinct values in a foreign key field.  In other words, if my locationID field is a foreign key to another table (in this case, a table called Locations), and it contains values like {7,7,7,12,12,31,31,31} I would want 3 different series to show up on the graph: one for all the Y values associated with the 7 key, one for the 12's and one for the 31's. 

Thanks!

Aaron
0
Giuseppe
Telerik team
answered on 06 Aug 2010, 02:45 PM
Hi Aaron,

You can use the DataGroupColumn feature to achieve the desired effect.

Hope this helps.


Greetings,
Freddie
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart (Obsolete)
Asked by
Aaron
Top achievements
Rank 2
Answers by
Yavor
Telerik team
Aaron
Top achievements
Rank 2
Giuseppe
Telerik team
Share this question
or