Hello
I have a cartesian chart that includes a barchart, which range is fixed and unique, and I have dynamic line series, which are user defined at run time (see attached screenshot).
Each lineseries is bound to a business objects that contains three properties: Color, which will be the color of the series, Code, which is a string that identifies the series, and Coll which is a collactiion of dates + decimals that make the series.
When I add the trackball functionality, I can see the bound values, but I would like to add the Code identifier, as otherwise user cannot tell which is which.
Thanks
Herald
------------------------------------------------------------------
<telerik:RadCartesianChart Grid.Row="1" Height="500" VerticalAlignment="Top">
<telerik:RadCartesianChart.Resources>
<DataTemplate x:Key="trackBallInfoTemplate">
<StackPanel Background="Wheat" Margin="3" Width="100">
<StackPanel Orientation="Horizontal">
<!--<TextBlock Text="{Binding Code}" FontWeight="Bold" />-->
<TextBlock Text="??? - " FontWeight="Bold" />
<TextBlock Text="{Binding DataPoint.Value, StringFormat=P2}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</telerik:RadCartesianChart.Resources>
<telerik:RadCartesianChart.Behaviors>
<telerik:ChartSelectionBehavior DataPointSelectionMode="None" />
<!--<telerik:ChartTooltipBehavior/>-->
<telerik:ChartTrackBallBehavior />
</telerik:RadCartesianChart.Behaviors>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:DateTimeContinuousAxis GapLength="0.9" Visibility="Collapsed" ShowLabels="False" TickThickness="0" PlotMode="OnTicks"/>
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis SmartLabelsMode="None" LabelFormat="P0" LabelStyle="{DynamicResource RagGridViewAxisLabel}"/>
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.SeriesProvider>
<telerik:ChartSeriesProvider Source="{Binding LineSeries}">
<telerik:ChartSeriesProvider.SeriesDescriptors>
<telerik:CategoricalSeriesDescriptor CategoryPath="Date" ValuePath="Value" ItemsSourcePath="Coll">
<telerik:CategoricalSeriesDescriptor.Style>
<Style TargetType="telerik:LineSeries">
<Setter Property="StrokeThickness" Value="2" />
<Setter Property="Stroke" Value="{Binding Color, Converter={StaticResource colorToSolidColorBrushValueConverter}}"></Setter>
<Setter Property="TrackBallInfoTemplate" Value="{StaticResource trackBallInfoTemplate}"></Setter>
</Style>
</telerik:CategoricalSeriesDescriptor.Style>
</telerik:CategoricalSeriesDescriptor>
</telerik:ChartSeriesProvider.SeriesDescriptors>
</telerik:ChartSeriesProvider>
</telerik:RadCartesianChart.SeriesProvider>
<telerik:RadCartesianChart.Grid>
<telerik:CartesianChartGrid MajorXLineDashArray="5 5" MajorYLineDashArray="5 5" MajorLinesVisibility="Y" />
</telerik:RadCartesianChart.Grid>
<telerik:RadCartesianChart.Series>
<telerik:BarSeries CategoryBinding="Date" ValueBinding="Value" ItemsSource="{Binding MainFundChart}" TrackBallInfoTemplate="{StaticResource trackBallInfoTemplate}">
<telerik:BarSeries.PointTemplate>
<DataTemplate>
<Rectangle Width="10" Fill="Green" />
</DataTemplate>
</telerik:BarSeries.PointTemplate>
</telerik:BarSeries>
</telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>
--------------------------------------------
public class LineSeriesItem
{
public string Code { get; set; }
public ObservableCollection<ChartItem> Coll { get; set; }
public System.Windows.Media.Color Color { get; set; }
}
public class ChartItem
{
public DateTime Date { get; set; }
public Decimal Value { get; set; }
}