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

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

2 Answers 204 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 16 Mar 2009, 07:39 PM
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 Answers, 1 is accepted

Sort by
0
Dessy
Telerik team
answered on 17 Mar 2009, 03:32 PM
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.
0
Randy
Top achievements
Rank 1
answered on 17 Mar 2009, 03:48 PM
Thanks.  I tried adding a line series with a constant value as you suggested.   this worked.  Thanks again.
Tags
Chart (Obsolete)
Asked by
Randy
Top achievements
Rank 1
Answers by
Dessy
Telerik team
Randy
Top achievements
Rank 1
Share this question
or