Two series, one chart, one point, one line

Thread is closed for posting
3 posts, 0 answers
  1. John
    John avatar
    4 posts
    Member since:
    Jun 2008

    Posted 14 Jan 2009 Link to this post

    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. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 19 Jan 2009 Link to this post

    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.
  3. John
    John avatar
    4 posts
    Member since:
    Jun 2008

    Posted 19 Jan 2009 Link to this post

    Brilliant, that fixed it.  Thank you for clarifying that point.
Back to Top