Articles in this section
Category / Section

How to display striplines in DateTimeAxis of WPF Chart?

1 min read

To set striplines to DateTimeAxis, convert the corresponding date-time value to double value, and set it to the start property of chart striplines as demonstrated in the following code sample.

Code snippet 

<chart:DateTimeAxis FontSize="14" Interval="1" IntervalType="Days"    
                    LabelFormat="dd/MMM/yyyy" > 
       <chart:DateTimeAxis.StripLines> 
          <chart:ChartStripLines> 
               <chart:ChartStripLine x:Name="stripLine"  Width="1"                      
                                     Background="Yellow" Opacity="0.5"/> 
          </chart:ChartStripLines> 
       </chart:DateTimeAxis.StripLines> 
</chart:DateTimeAxis> 
 

 

Here, the width of striplines is calculated based on the axis interval.

 

stripLine.Start = new DateTime(2009, 1, 3).ToOADate(); 

 

The following screenshot illustrates the output.

DateTimeStripline in WPF Chart.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied