How do I add a threshold (dotted line) to a bar chart?

Thread is closed for posting
3 posts, 0 answers
  1. Randy
    Randy avatar
    73 posts
    Member since:
    Oct 2007

    Posted 16 Mar 2009 Link to this post

    Is it possible to add a dotted line with a label in the middle of a bar chart?  I want to represent a threshold using a dotted line across the barchart so that the user can see which entries are above a certain number.  

    Thanks,
  2. Dessy
    Admin
    Dessy avatar
    73 posts

    Posted 17 Mar 2009 Link to this post

    Hi Randy,

    In order to create a dotted line,you can use a marked zone with values for ValueStartX , ValueEndX and ValueStartY, ValueEndY  properties. Then use its border to specify the line color and style. Unfortunately this method does not provide labels option outside the marked zone.
    Here is an example:

     <PlotArea> 
           <MarkedZones> 
                 <telerik:ChartMarkedZone Name="Marked zone 1" ValueEndX="100"  ValueStartX="0" ValueStartY="20" ValueEndY="20">  
                           <Appearance> 
                                <Border Color="Blue" PenStyle="Dot" Width="2" /> 
                            </Appearance> 
                   </telerik:ChartMarkedZone> 
           </MarkedZones> 
     </PlotArea> 
     

    Alternatively , you can add a line series with constant values and set its appearance as shown below. This way you will have a designated legend item.

    <telerik:RadChart ID="RadChart1" runat="Server" AutoLayout="True">    
        <Series>    
            <telerik:ChartSeries Type="Bar">    
                <Items>    
                    <telerik:ChartSeriesItem YValue="20">    
                    </telerik:ChartSeriesItem>    
                    <telerik:ChartSeriesItem YValue="40">    
                    </telerik:ChartSeriesItem>    
                    <telerik:ChartSeriesItem YValue="30">    
                    </telerik:ChartSeriesItem>    
                </Items>    
            </telerik:ChartSeries>    
            <telerik:ChartSeries Type="Line" Name="Threshold">    
    <Appearance LineSeriesAppearance-PenStyle="Dot">  
     
     
    </Appearance> 
                <Items>    
                    <telerik:ChartSeriesItem YValue="10">   
                    </telerik:ChartSeriesItem>    
                    <telerik:ChartSeriesItem YValue="10">    
                    </telerik:ChartSeriesItem>    
                    <telerik:ChartSeriesItem YValue="10">    
                    </telerik:ChartSeriesItem>   
                </Items>    
            </telerik:ChartSeries>    
        </Series>    
          
    </telerik:RadChart>    
     



    Best wishes,
    Dessy
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Randy
    Randy avatar
    73 posts
    Member since:
    Oct 2007

    Posted 17 Mar 2009 Link to this post

    Thanks.  I tried adding a line series with a constant value as you suggested.   this worked.  Thanks again.
Back to Top