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

Two series, one chart, one point, one line

2 Answers 83 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 15 Jan 2009, 01:19 AM

I have what I think is a straight forward problem with what I hope is a simple solution.  I want to create a chart in ASPX with two series of data, one that shows up as a line, and one that show up as point data.  So I created a chart with two series and gave them their appropriate types.  However both data sets show up as points.  Here are the important lines:

<telerik:RadChart ID="CPUIdle_RadChart" runat="server" DataSourceID="myData" 
                        Skin="Gradient" DefaultType="Point">  
<telerik:ChartSeries Name="ThisMachine" Type="Line">  
<telerik:ChartSeries Name="EcoSystem" Type="Point">  

When I take the defaultType off of the <telerik:RadChart> control, the chart shows up as a bar chart for both series.  What ever I set the DefaultType to, the chart sets both series to that type of display.  Both lines always inherit the DefaultType.  How do I get the Series to honor the ChartSeries Type?

<telerik:RadChart ID="CPUIdle_RadChart" runat="server" DataSourceID="myData" 
                        Skin="Gradient" DefaultType="Point">  
                        <ChartTitle> 
                            <Appearance Corners="Round, Round, Round, Round, 3" Position-AlignedPosition="Top">  
                                <FillStyle MainColor="177, 183, 144">  
                                </FillStyle> 
                                <Border Color="64, 64, 64" /> 
                            </Appearance> 
                            <TextBlock Text="CPU at Idle">  
                                <Appearance AutoTextWrap="Auto" TextProperties-Color="White" TextProperties-Font="Verdana, 14.25pt, style=Bold">  
                                </Appearance> 
                            </TextBlock> 
                            <Marker> 
                                <Appearance Corners="Rectangle, Rectangle, Rectangle, Rectangle, 3" > 
                                </Appearance> 
                            </Marker> 
                        </ChartTitle> 
                        <Series> 
                            <telerik:ChartSeries Name="ThisMachine" Type="Line">  
                                <Appearance> 
                                    <FillStyle MainColor="199, 243, 178" SecondColor="17, 147, 7">  
                                    </FillStyle> 
                                    <LabelAppearance Corners="Rectangle, Rectangle, Rectangle, Rectangle, 3" Dimensions-Margins="1px, 1px, 1px, 1px" 
                                        Dimensions-Paddings="1px, 1px, 1px, 1px">  
                                    </LabelAppearance> 
                                    <PointMark Corners="Rectangle, Rectangle, Rectangle, Rectangle, 3">  
                                    </PointMark> 
                                    <TextAppearance TextProperties-Color="Black">  
                                    </TextAppearance> 
                                    <EmptyValue Mode="Approximation">  
                                        <PointMark Corners="Rectangle, Rectangle, Rectangle, Rectangle, 3" Dimensions-Margins="1px, 1px, 1px, 1px">  
                                        </PointMark> 
                                    </EmptyValue> 
                                    <Border Color="Black" /> 
                                </Appearance> 
                            </telerik:ChartSeries> 
                            <telerik:ChartSeries Name="EcoSystem" Type="Point">  
                                <Appearance Corners="Rectangle, Rectangle, Rectangle, Rectangle, 3">  
                                    <FillStyle MainColor="253, 226, 0" SecondColor="255, 156, 0">  
                                    </FillStyle> 
                                    <LabelAppearance Corners="Rectangle, Rectangle, Rectangle, Rectangle, 3" Dimensions-Margins="1px, 1px, 1px, 1px" 
                                        Dimensions-Paddings="1px, 1px, 1px, 1px">  
                                    </LabelAppearance> 
                                    <PointMark Corners="Rectangle, Rectangle, Rectangle, Rectangle, 3">  
                                    </PointMark> 
                                    <TextAppearance Corners="Rectangle, Rectangle, Rectangle, Rectangle, 3" Dimensions-Margins="1px, 1px, 1px, 1px" 
                                        Dimensions-Paddings="1px, 1px, 1px, 1px" TextProperties-Color="Black">  
                                    </TextAppearance> 
                                    <EmptyValue> 
                                        <PointMark Corners="Rectangle, Rectangle, Rectangle, Rectangle, 3" Dimensions-Margins="1px, 1px, 1px, 1px">  
                                        </PointMark> 
                                    </EmptyValue> 
                                    <Border Color="Black" /> 
                                </Appearance> 
                            </telerik:ChartSeries> 
                        </Series> 

2 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 19 Jan 2009, 07:15 AM
Hi John,

This is actually how RadChart works -- all the series will be cleared before databinding. Then new series will be created, they will correspond to the datasource columns. So, in this case it just honors the default type.

Still, you can force RadChart not to delete the series you have defined, but use them. For this you will need to set DataYColumn property of each series to the name of the column which will provide the values for this series. Here is an example (given that there are tow columns with names "ThisMachine" and "EcoSystem"):

<telerik:ChartSeries Name="ThisMachine" Type="Line" DataYColumn="ThisMachine"
..... 
</telerik:ChartSeries> 
<telerik:ChartSeries Name="EcoSystem" Type="Point" DataYColumn="EcoSystem"
..... 
</telerik:ChartSeries> 

Hope this helps.

Kind regards,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
John
Top achievements
Rank 1
answered on 19 Jan 2009, 10:52 PM
Brilliant, that fixed it.  Thank you for clarifying that point.
Tags
Chart (Obsolete)
Asked by
John
Top achievements
Rank 1
Answers by
Ves
Telerik team
John
Top achievements
Rank 1
Share this question
or