ComponentOne Chart for WPF and Silverlight
Chart for WPF and Silverlight / Chart Features / Data Point Converter
In This Topic
    Data Point Converter
    In This Topic

    The DataPointConverter class is useful for creating complex point labels of template in xaml. The DataPointConverter uses the converter parameter to generate string based on the properties of the current data point. The converter parameter string can include the following keywords that are replaced by real values of properties for each point:

    The keyword starts from # and should be in curved brackets. Optional format string can be added inside brackets like in the following string.Format():. {#Values:0.0}

    The following xaml markup shows how to use the DataPointConverter class:

    XAML
    Copy Code
    <c1chart:C1Chart Name="chart" ChartType="LineSymbols" Margin="20" >
       <c1chart:C1Chart.Resources>
         <c1chart:DataPointConverter x:Key="cnv"/>
       </c1chart:C1Chart.Resources>
       <c1chart:C1Chart.Data>
         <c1chart:ChartData>
           <c1chart:XYDataSeries Label="S1"
             XValues="1,2,3,4,5,6,7" Values="1,2,3,4,3,4,2" >
             <c1chart:XYDataSeries.PointLabelTemplate>
               <DataTemplate>
                 <Border BorderBrush="Black" BorderThickness="0.5"
                   Background="#70FFFFFF"
                   c1chart:PlotElement.LabelAlignment="MiddleCenter">
                   <TextBlock>
                     <TextBlock.Text>
                       <Binding Converter="{StaticResource cnv}">
                         <Binding.ConverterParameter>
                           {#SeriesLabel}{#NewLine}
                           X={#XValues:0.0},Y={#Values:0.0}{#NewLine}
                        SI={#SeriesIndex},PI={#PointIndex}
                         </Binding.ConverterParameter>
                       </Binding>
                     </TextBlock.Text>
                   </TextBlock>
                 </Border>
               </DataTemplate>
             </c1chart:XYDataSeries.PointLabelTemplate>
           </c1chart:XYDataSeries>
         </c1chart:ChartData>
       </c1chart:C1Chart.Data>
    </c1chart:C1Chart>
    

     

    See Also