This question is locked. New answers and comments are not allowed.
The ItemToolTipOpening event doesn't even fire:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/CorporateBondCalculator;component/CBCResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Name="ChartPlotAreaStyle" TargetType="Grid" />
<Style x:Name="RadChartPlotAreaStyle" TargetType="telerik:ClipPanel" />
<Style x:Name="ChartLegendStyle" TargetType="toolkit:Legend">
<Setter Property="Foreground" Value="Orange"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="BorderBrush" Value="Orange"/>
<Setter Property="Margin" Value="10,0"/>
</Style>
<Style x:Key="RadChartLegendStyle" TargetType="telerik:ChartLegend">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Orange"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="BorderBrush" Value="Orange"/>
<Setter Property="Margin" Value="10,0"/>
<Setter Property="FontSize" Value="10"/>
</Style>
<Style x:Key="ItemLabelStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="AxisTitleStyle" TargetType="telerik:AxisTitle">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="DataPointStyle" TargetType="toolkit:LineDataPoint">
<Setter Property="Visibility" Value="Collapsed"/>
<Setter Property="Opacity" Value="0" />
<Setter Property="BorderBrush" Value="White"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="toolkit:LineDataPoint">
<Grid x:Name="Root" Opacity="1">
<ToolTipService.ToolTip>
<StackPanel Margin="3">
<sdk:Label Content="{TemplateBinding DependentValue}"/>
</StackPanel>
</ToolTipService.ToolTip>
<Ellipse StrokeThickness="{TemplateBinding BorderThickness}" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Style="{StaticResource TwoFactorGridGradient}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SeriesDisplayed">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.3"/>
<VisualTransition From="OAS" GeneratedDuration="0:0:0.3"/>
<VisualTransition From="USDEquivSpread" GeneratedDuration="0:0:0.3"/>
<VisualTransition From="Basis" GeneratedDuration="0:0:0.3"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="OAS">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="radUSDEquivHistory">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<System:Boolean>False</System:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radUSDEquivHistory" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radBasis" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="USDEquivSpread">
<Storyboard>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radOASHistory" d:IsOptimized="True"/>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="radOASHistory">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<System:Boolean>False</System:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="radUSDEquivHistory">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<System:Boolean>True</System:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radUSDEquivHistory" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radBasis" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Basis">
<Storyboard>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radOASHistory" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radUSDEquivHistory" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="borderTop" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" Margin="0"
Background="Transparent"
MouseLeftButtonDown="Border_MouseRightButtonDown"
KeyDown="Border_KeyDown">
<menu:ContextMenuService.ContextMenu>
<menu:ContextMenu>
<menu:MenuItem x:Name="CopyMenuItem" Header="Copy Graph" Click="CopyMenuItem_Click" FontSize="12">
</menu:MenuItem>
<menu:MenuItem x:Name="CopyData" Header="Copy Data" Click="CopyData_Click" FontSize="12"/>
</menu:ContextMenu>
</menu:ContextMenuService.ContextMenu>
<Grid Background="Transparent">
<TextBox x:Name="InvisibleTop" IsTabStop="True" Foreground="Transparent" Background="Transparent" Width="0" />
<Viewbox HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Uniform" >
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button x:Name="btnClose" Grid.Row="0" Content="Close" HorizontalAlignment="Left" VerticalAlignment="Top" FontWeight="Bold" Click="btnClose_Click" />
<ComboBox x:Name="comboBoxSeries" Grid.Row="0" Width="170" SelectionChanged="ComboBoxSeriesSelectionChanged" HorizontalContentAlignment="Center">
<ComboBoxItem Content="OAS" IsSelected="True"/>
<ComboBoxItem Content="USD Equivalent Spread"/>
<ComboBoxItem Content="Basis"/>
</ComboBox>
<ToggleButton x:Name="tglLegend" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Top" Content="Hide Legend" FontWeight="Bold" Checked="ToggleButton_Checked" Unchecked="ToggleButton_Unchecked" />
<telerik:RadChart x:Name="radOASHistory" Grid.Row="1" Margin="0,0,0,0" UseLayoutRounding="True" BorderThickness="0" Background="Transparent"
VerticalAlignment="Top" VerticalContentAlignment="Stretch" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch"
Height="500" Width="1300" MinHeight="300" MinWidth="700" MaxHeight="700" MaxWidth="1300"
LegendStyle="{StaticResource RadChartLegendStyle}"
Visibility="Visible"
>
<telerik:RadChart.DefaultView>
<telerik:ChartDefaultView>
<telerik:ChartDefaultView.ChartLegend>
<telerik:ChartLegend Header="" />
</telerik:ChartDefaultView.ChartLegend>
<telerik:ChartDefaultView.ChartArea>
<telerik:ChartArea PlotAreaStyle="{StaticResource RadChartPlotAreaStyle}">
<telerik:ChartArea.AnimationSettings>
<telerik:AnimationSettings ItemDelay="00:00:00.0" ItemAnimationDuration="00:00:00" DefaultSeriesDelay="00:00:00" />
</telerik:ChartArea.AnimationSettings>
<telerik:ChartArea.AxisX>
<telerik:AxisX AutoRange="True" IsDateTime="True" StripLinesVisibility="Collapsed"
LayoutMode="Normal" DefaultLabelFormat="MM/dd/yyyy" LabelRotationAngle="45">
<telerik:AxisX.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisX.AxisStyles>
</telerik:AxisX>
</telerik:ChartArea.AxisX>
<telerik:ChartArea.AxisY>
<telerik:AxisY Title="OAS [bp/yr]" AxisLabelsVisibility="Collapsed" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" TitleStyle="{StaticResource AxisTitleStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AxisY>
<telerik:ChartArea.AdditionalYAxes>
<telerik:AxisY AutoRange="True" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AdditionalYAxes>
</telerik:ChartArea>
</telerik:ChartDefaultView.ChartArea>
</telerik:ChartDefaultView>
</telerik:RadChart.DefaultView>
<telerik:RadChart.SeriesMappings>
<telerik:SeriesMapping>
<telerik:SeriesMapping.SeriesDefinition>
<telerik:LineSeriesDefinition ShowItemLabels="False" ShowPointMarks="False" />
</telerik:SeriesMapping.SeriesDefinition>
<telerik:SeriesMapping.ItemMappings>
<telerik:ItemMapping DataPointMember="YValue" />
</telerik:SeriesMapping.ItemMappings>
</telerik:SeriesMapping>
</telerik:RadChart.SeriesMappings>
</telerik:RadChart>
<telerik:RadChart x:Name="radUSDEquivHistory" Grid.Row="1" Margin="0,0,0,0" UseLayoutRounding="True" BorderThickness="0" Background="Transparent"
VerticalAlignment="Top" VerticalContentAlignment="Stretch" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch"
Height="500" Width="1300" MinHeight="300" MinWidth="700" MaxHeight="700" MaxWidth="1300"
LegendStyle="{StaticResource RadChartLegendStyle}"
Visibility="Visible"
>
<telerik:RadChart.DefaultView>
<telerik:ChartDefaultView>
<telerik:ChartDefaultView.ChartLegend>
<telerik:ChartLegend Header="" />
</telerik:ChartDefaultView.ChartLegend>
<telerik:ChartDefaultView.ChartArea>
<telerik:ChartArea PlotAreaStyle="{StaticResource RadChartPlotAreaStyle}">
<telerik:ChartArea.AnimationSettings>
<telerik:AnimationSettings ItemDelay="00:00:00.0" ItemAnimationDuration="00:00:00" DefaultSeriesDelay="00:00:00" />
</telerik:ChartArea.AnimationSettings>
<telerik:ChartArea.AxisX>
<telerik:AxisX AutoRange="True" IsDateTime="True" StripLinesVisibility="Collapsed"
LayoutMode="Normal" DefaultLabelFormat="MM/dd/yyyy" LabelRotationAngle="45">
<telerik:AxisX.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisX.AxisStyles>
</telerik:AxisX>
</telerik:ChartArea.AxisX>
<telerik:ChartArea.AxisY>
<telerik:AxisY Title="OAS [bp/yr]" AxisLabelsVisibility="Collapsed" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" TitleStyle="{StaticResource AxisTitleStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AxisY>
<telerik:ChartArea.AdditionalYAxes>
<telerik:AxisY AutoRange="True" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AdditionalYAxes>
</telerik:ChartArea>
</telerik:ChartDefaultView.ChartArea>
</telerik:ChartDefaultView>
</telerik:RadChart.DefaultView>
<telerik:RadChart.SeriesMappings>
<telerik:SeriesMapping>
<telerik:SeriesMapping.SeriesDefinition>
<telerik:LineSeriesDefinition ShowItemLabels="False" ShowPointMarks="False" />
</telerik:SeriesMapping.SeriesDefinition>
<telerik:SeriesMapping.ItemMappings>
<telerik:ItemMapping DataPointMember="YValue" />
</telerik:SeriesMapping.ItemMappings>
</telerik:SeriesMapping>
</telerik:RadChart.SeriesMappings>
</telerik:RadChart>
<telerik:RadChart x:Name="radBasis" Grid.Row="1" Margin="0,0,0,0" UseLayoutRounding="True" BorderThickness="0" Background="Transparent"
VerticalAlignment="Top" VerticalContentAlignment="Stretch" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch"
Height="500" Width="1300" MinHeight="300" MinWidth="700" MaxHeight="700" MaxWidth="1300"
LegendStyle="{StaticResource RadChartLegendStyle}"
Visibility="Visible"
>
<telerik:RadChart.DefaultView>
<telerik:ChartDefaultView>
<telerik:ChartDefaultView.ChartLegend>
<telerik:ChartLegend Header="" />
</telerik:ChartDefaultView.ChartLegend>
<telerik:ChartDefaultView.ChartArea>
<telerik:ChartArea PlotAreaStyle="{StaticResource RadChartPlotAreaStyle}" ItemToolTipOpening="ChartArea_ItemToolTipOpening">
<telerik:ChartArea.AnimationSettings>
<telerik:AnimationSettings ItemDelay="00:00:00.0" ItemAnimationDuration="00:00:00" DefaultSeriesDelay="00:00:00" />
</telerik:ChartArea.AnimationSettings>
<telerik:ChartArea.AxisX>
<telerik:AxisX AutoRange="True" IsDateTime="True" StripLinesVisibility="Collapsed"
LayoutMode="Normal" DefaultLabelFormat="MM/dd/yyyy" LabelRotationAngle="45">
<telerik:AxisX.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisX.AxisStyles>
</telerik:AxisX>
</telerik:ChartArea.AxisX>
<telerik:ChartArea.AxisY>
<telerik:AxisY Title="OAS [bp/yr]" AxisLabelsVisibility="Collapsed" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" TitleStyle="{StaticResource AxisTitleStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AxisY>
<telerik:ChartArea.AdditionalYAxes>
<telerik:AxisY AutoRange="True" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AdditionalYAxes>
</telerik:ChartArea>
</telerik:ChartDefaultView.ChartArea>
</telerik:ChartDefaultView>
</telerik:RadChart.DefaultView>
</telerik:RadChart>
</Grid>
</Viewbox>
</Grid>
</Border>
</Grid>
</UserControl>
public void ProcessRadChart(ObservableCollection<PcyaSimServiceReference.PCYAsimServiceHistoryItem> results)
{
if (results == null ||
results.Count == 0)
return;
_data = results;
tglLegend.IsChecked = true;
radOASHistory.SeriesMappings.Clear();
radUSDEquivHistory.SeriesMappings.Clear();
radBasis.SeriesMappings.Clear();
PcyaSimServiceReference.PCYAsimServiceHistoryItem hi;
SeriesMapping seriesMapping;
SeriesMapping seriesMapping2;
SeriesMapping seriesMapping3;
ChartLegendItem legendItem;
ChartLegendItem legendItem2;
ChartLegendItem legendItem3;
SolidColorBrush lineColor;
LineSeriesDefinition line;
for (int idx = 0; idx < results.Count; idx++)
{
hi = results[idx];
seriesMapping = new SeriesMapping();
seriesMapping2 = new SeriesMapping();
seriesMapping3 = new SeriesMapping();
legendItem = new ChartLegendItem();
legendItem2 = new ChartLegendItem();
legendItem3 = new ChartLegendItem();
legendItem.Label = hi.Description;
legendItem2.Label = hi.Description;
legendItem3.Label = hi.Description;
if (idx < Colors.Length)
lineColor = new SolidColorBrush(Colors[idx]);
else
lineColor = new SolidColorBrush(GenerateRandomColor());
legendItem.Foreground = lineColor;
legendItem2.Foreground = lineColor;
legendItem3.Foreground = lineColor;
legendItem.MarkerFill = lineColor;
legendItem2.MarkerFill = lineColor;
legendItem3.MarkerFill = lineColor;
radOASHistory.DefaultView.ChartLegend.Items.Add(legendItem);
radUSDEquivHistory.DefaultView.ChartLegend.Items.Add(legendItem2);
radBasis.DefaultView.ChartLegend.Items.Add(legendItem3);
line = new LineSeriesDefinition
{
ShowItemLabels = false,
ShowPointMarks = false,
ShowItemToolTips = true
};
line.ItemToolTipFormat = "Value: #YValue{C4}\nDate: #XValue{C4}\nSeries: #DATAITEM.Description";
line.Appearance.Stroke = lineColor;
line.Appearance.Fill = lineColor;
seriesMapping.SeriesDefinition = line;
seriesMapping2.SeriesDefinition = line;
seriesMapping3.SeriesDefinition = line;
seriesMapping.ItemMappings.Add(new ItemMapping("PriceDate", DataPointMember.XValue));
seriesMapping.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
seriesMapping2.ItemMappings.Add(new ItemMapping("PriceDate", DataPointMember.XValue));
seriesMapping2.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
seriesMapping3.ItemMappings.Add(new ItemMapping("PriceDate", DataPointMember.XValue));
seriesMapping3.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
seriesMapping.ItemsSource = hi.OAS;
seriesMapping2.ItemsSource = hi.USDEquivSpread;
seriesMapping3.ItemsSource = hi.Basis;
radOASHistory.SeriesMappings.Add(seriesMapping);
radUSDEquivHistory.SeriesMappings.Add(seriesMapping2);
radBasis.SeriesMappings.Add(seriesMapping3);
}
if (ProcessedOAS != null)
ProcessedOAS(this, new EventArgs());
}
private void ChartArea_ItemToolTipOpening(ItemToolTip2D tooltip, ItemToolTipEventArgs e)
{
}
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/CorporateBondCalculator;component/CBCResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Name="ChartPlotAreaStyle" TargetType="Grid" />
<Style x:Name="RadChartPlotAreaStyle" TargetType="telerik:ClipPanel" />
<Style x:Name="ChartLegendStyle" TargetType="toolkit:Legend">
<Setter Property="Foreground" Value="Orange"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="BorderBrush" Value="Orange"/>
<Setter Property="Margin" Value="10,0"/>
</Style>
<Style x:Key="RadChartLegendStyle" TargetType="telerik:ChartLegend">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Orange"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="BorderBrush" Value="Orange"/>
<Setter Property="Margin" Value="10,0"/>
<Setter Property="FontSize" Value="10"/>
</Style>
<Style x:Key="ItemLabelStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="AxisTitleStyle" TargetType="telerik:AxisTitle">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="DataPointStyle" TargetType="toolkit:LineDataPoint">
<Setter Property="Visibility" Value="Collapsed"/>
<Setter Property="Opacity" Value="0" />
<Setter Property="BorderBrush" Value="White"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="toolkit:LineDataPoint">
<Grid x:Name="Root" Opacity="1">
<ToolTipService.ToolTip>
<StackPanel Margin="3">
<sdk:Label Content="{TemplateBinding DependentValue}"/>
</StackPanel>
</ToolTipService.ToolTip>
<Ellipse StrokeThickness="{TemplateBinding BorderThickness}" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Style="{StaticResource TwoFactorGridGradient}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SeriesDisplayed">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.3"/>
<VisualTransition From="OAS" GeneratedDuration="0:0:0.3"/>
<VisualTransition From="USDEquivSpread" GeneratedDuration="0:0:0.3"/>
<VisualTransition From="Basis" GeneratedDuration="0:0:0.3"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="OAS">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="radUSDEquivHistory">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<System:Boolean>False</System:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radUSDEquivHistory" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radBasis" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="USDEquivSpread">
<Storyboard>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radOASHistory" d:IsOptimized="True"/>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="radOASHistory">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<System:Boolean>False</System:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="radUSDEquivHistory">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<System:Boolean>True</System:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radUSDEquivHistory" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radBasis" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Basis">
<Storyboard>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radOASHistory" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="radUSDEquivHistory" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="borderTop" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" Margin="0"
Background="Transparent"
MouseLeftButtonDown="Border_MouseRightButtonDown"
KeyDown="Border_KeyDown">
<menu:ContextMenuService.ContextMenu>
<menu:ContextMenu>
<menu:MenuItem x:Name="CopyMenuItem" Header="Copy Graph" Click="CopyMenuItem_Click" FontSize="12">
</menu:MenuItem>
<menu:MenuItem x:Name="CopyData" Header="Copy Data" Click="CopyData_Click" FontSize="12"/>
</menu:ContextMenu>
</menu:ContextMenuService.ContextMenu>
<Grid Background="Transparent">
<TextBox x:Name="InvisibleTop" IsTabStop="True" Foreground="Transparent" Background="Transparent" Width="0" />
<Viewbox HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Uniform" >
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button x:Name="btnClose" Grid.Row="0" Content="Close" HorizontalAlignment="Left" VerticalAlignment="Top" FontWeight="Bold" Click="btnClose_Click" />
<ComboBox x:Name="comboBoxSeries" Grid.Row="0" Width="170" SelectionChanged="ComboBoxSeriesSelectionChanged" HorizontalContentAlignment="Center">
<ComboBoxItem Content="OAS" IsSelected="True"/>
<ComboBoxItem Content="USD Equivalent Spread"/>
<ComboBoxItem Content="Basis"/>
</ComboBox>
<ToggleButton x:Name="tglLegend" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Top" Content="Hide Legend" FontWeight="Bold" Checked="ToggleButton_Checked" Unchecked="ToggleButton_Unchecked" />
<telerik:RadChart x:Name="radOASHistory" Grid.Row="1" Margin="0,0,0,0" UseLayoutRounding="True" BorderThickness="0" Background="Transparent"
VerticalAlignment="Top" VerticalContentAlignment="Stretch" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch"
Height="500" Width="1300" MinHeight="300" MinWidth="700" MaxHeight="700" MaxWidth="1300"
LegendStyle="{StaticResource RadChartLegendStyle}"
Visibility="Visible"
>
<telerik:RadChart.DefaultView>
<telerik:ChartDefaultView>
<telerik:ChartDefaultView.ChartLegend>
<telerik:ChartLegend Header="" />
</telerik:ChartDefaultView.ChartLegend>
<telerik:ChartDefaultView.ChartArea>
<telerik:ChartArea PlotAreaStyle="{StaticResource RadChartPlotAreaStyle}">
<telerik:ChartArea.AnimationSettings>
<telerik:AnimationSettings ItemDelay="00:00:00.0" ItemAnimationDuration="00:00:00" DefaultSeriesDelay="00:00:00" />
</telerik:ChartArea.AnimationSettings>
<telerik:ChartArea.AxisX>
<telerik:AxisX AutoRange="True" IsDateTime="True" StripLinesVisibility="Collapsed"
LayoutMode="Normal" DefaultLabelFormat="MM/dd/yyyy" LabelRotationAngle="45">
<telerik:AxisX.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisX.AxisStyles>
</telerik:AxisX>
</telerik:ChartArea.AxisX>
<telerik:ChartArea.AxisY>
<telerik:AxisY Title="OAS [bp/yr]" AxisLabelsVisibility="Collapsed" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" TitleStyle="{StaticResource AxisTitleStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AxisY>
<telerik:ChartArea.AdditionalYAxes>
<telerik:AxisY AutoRange="True" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AdditionalYAxes>
</telerik:ChartArea>
</telerik:ChartDefaultView.ChartArea>
</telerik:ChartDefaultView>
</telerik:RadChart.DefaultView>
<telerik:RadChart.SeriesMappings>
<telerik:SeriesMapping>
<telerik:SeriesMapping.SeriesDefinition>
<telerik:LineSeriesDefinition ShowItemLabels="False" ShowPointMarks="False" />
</telerik:SeriesMapping.SeriesDefinition>
<telerik:SeriesMapping.ItemMappings>
<telerik:ItemMapping DataPointMember="YValue" />
</telerik:SeriesMapping.ItemMappings>
</telerik:SeriesMapping>
</telerik:RadChart.SeriesMappings>
</telerik:RadChart>
<telerik:RadChart x:Name="radUSDEquivHistory" Grid.Row="1" Margin="0,0,0,0" UseLayoutRounding="True" BorderThickness="0" Background="Transparent"
VerticalAlignment="Top" VerticalContentAlignment="Stretch" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch"
Height="500" Width="1300" MinHeight="300" MinWidth="700" MaxHeight="700" MaxWidth="1300"
LegendStyle="{StaticResource RadChartLegendStyle}"
Visibility="Visible"
>
<telerik:RadChart.DefaultView>
<telerik:ChartDefaultView>
<telerik:ChartDefaultView.ChartLegend>
<telerik:ChartLegend Header="" />
</telerik:ChartDefaultView.ChartLegend>
<telerik:ChartDefaultView.ChartArea>
<telerik:ChartArea PlotAreaStyle="{StaticResource RadChartPlotAreaStyle}">
<telerik:ChartArea.AnimationSettings>
<telerik:AnimationSettings ItemDelay="00:00:00.0" ItemAnimationDuration="00:00:00" DefaultSeriesDelay="00:00:00" />
</telerik:ChartArea.AnimationSettings>
<telerik:ChartArea.AxisX>
<telerik:AxisX AutoRange="True" IsDateTime="True" StripLinesVisibility="Collapsed"
LayoutMode="Normal" DefaultLabelFormat="MM/dd/yyyy" LabelRotationAngle="45">
<telerik:AxisX.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisX.AxisStyles>
</telerik:AxisX>
</telerik:ChartArea.AxisX>
<telerik:ChartArea.AxisY>
<telerik:AxisY Title="OAS [bp/yr]" AxisLabelsVisibility="Collapsed" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" TitleStyle="{StaticResource AxisTitleStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AxisY>
<telerik:ChartArea.AdditionalYAxes>
<telerik:AxisY AutoRange="True" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AdditionalYAxes>
</telerik:ChartArea>
</telerik:ChartDefaultView.ChartArea>
</telerik:ChartDefaultView>
</telerik:RadChart.DefaultView>
<telerik:RadChart.SeriesMappings>
<telerik:SeriesMapping>
<telerik:SeriesMapping.SeriesDefinition>
<telerik:LineSeriesDefinition ShowItemLabels="False" ShowPointMarks="False" />
</telerik:SeriesMapping.SeriesDefinition>
<telerik:SeriesMapping.ItemMappings>
<telerik:ItemMapping DataPointMember="YValue" />
</telerik:SeriesMapping.ItemMappings>
</telerik:SeriesMapping>
</telerik:RadChart.SeriesMappings>
</telerik:RadChart>
<telerik:RadChart x:Name="radBasis" Grid.Row="1" Margin="0,0,0,0" UseLayoutRounding="True" BorderThickness="0" Background="Transparent"
VerticalAlignment="Top" VerticalContentAlignment="Stretch" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch"
Height="500" Width="1300" MinHeight="300" MinWidth="700" MaxHeight="700" MaxWidth="1300"
LegendStyle="{StaticResource RadChartLegendStyle}"
Visibility="Visible"
>
<telerik:RadChart.DefaultView>
<telerik:ChartDefaultView>
<telerik:ChartDefaultView.ChartLegend>
<telerik:ChartLegend Header="" />
</telerik:ChartDefaultView.ChartLegend>
<telerik:ChartDefaultView.ChartArea>
<telerik:ChartArea PlotAreaStyle="{StaticResource RadChartPlotAreaStyle}" ItemToolTipOpening="ChartArea_ItemToolTipOpening">
<telerik:ChartArea.AnimationSettings>
<telerik:AnimationSettings ItemDelay="00:00:00.0" ItemAnimationDuration="00:00:00" DefaultSeriesDelay="00:00:00" />
</telerik:ChartArea.AnimationSettings>
<telerik:ChartArea.AxisX>
<telerik:AxisX AutoRange="True" IsDateTime="True" StripLinesVisibility="Collapsed"
LayoutMode="Normal" DefaultLabelFormat="MM/dd/yyyy" LabelRotationAngle="45">
<telerik:AxisX.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisX.AxisStyles>
</telerik:AxisX>
</telerik:ChartArea.AxisX>
<telerik:ChartArea.AxisY>
<telerik:AxisY Title="OAS [bp/yr]" AxisLabelsVisibility="Collapsed" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" TitleStyle="{StaticResource AxisTitleStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AxisY>
<telerik:ChartArea.AdditionalYAxes>
<telerik:AxisY AutoRange="True" StripLinesVisibility="Collapsed">
<telerik:AxisY.AxisStyles>
<telerik:AxisStyles ItemLabelStyle="{StaticResource ItemLabelStyle}" />
</telerik:AxisY.AxisStyles>
</telerik:AxisY>
</telerik:ChartArea.AdditionalYAxes>
</telerik:ChartArea>
</telerik:ChartDefaultView.ChartArea>
</telerik:ChartDefaultView>
</telerik:RadChart.DefaultView>
</telerik:RadChart>
</Grid>
</Viewbox>
</Grid>
</Border>
</Grid>
</UserControl>
public void ProcessRadChart(ObservableCollection<PcyaSimServiceReference.PCYAsimServiceHistoryItem> results)
{
if (results == null ||
results.Count == 0)
return;
_data = results;
tglLegend.IsChecked = true;
radOASHistory.SeriesMappings.Clear();
radUSDEquivHistory.SeriesMappings.Clear();
radBasis.SeriesMappings.Clear();
PcyaSimServiceReference.PCYAsimServiceHistoryItem hi;
SeriesMapping seriesMapping;
SeriesMapping seriesMapping2;
SeriesMapping seriesMapping3;
ChartLegendItem legendItem;
ChartLegendItem legendItem2;
ChartLegendItem legendItem3;
SolidColorBrush lineColor;
LineSeriesDefinition line;
for (int idx = 0; idx < results.Count; idx++)
{
hi = results[idx];
seriesMapping = new SeriesMapping();
seriesMapping2 = new SeriesMapping();
seriesMapping3 = new SeriesMapping();
legendItem = new ChartLegendItem();
legendItem2 = new ChartLegendItem();
legendItem3 = new ChartLegendItem();
legendItem.Label = hi.Description;
legendItem2.Label = hi.Description;
legendItem3.Label = hi.Description;
if (idx < Colors.Length)
lineColor = new SolidColorBrush(Colors[idx]);
else
lineColor = new SolidColorBrush(GenerateRandomColor());
legendItem.Foreground = lineColor;
legendItem2.Foreground = lineColor;
legendItem3.Foreground = lineColor;
legendItem.MarkerFill = lineColor;
legendItem2.MarkerFill = lineColor;
legendItem3.MarkerFill = lineColor;
radOASHistory.DefaultView.ChartLegend.Items.Add(legendItem);
radUSDEquivHistory.DefaultView.ChartLegend.Items.Add(legendItem2);
radBasis.DefaultView.ChartLegend.Items.Add(legendItem3);
line = new LineSeriesDefinition
{
ShowItemLabels = false,
ShowPointMarks = false,
ShowItemToolTips = true
};
line.ItemToolTipFormat = "Value: #YValue{C4}\nDate: #XValue{C4}\nSeries: #DATAITEM.Description";
line.Appearance.Stroke = lineColor;
line.Appearance.Fill = lineColor;
seriesMapping.SeriesDefinition = line;
seriesMapping2.SeriesDefinition = line;
seriesMapping3.SeriesDefinition = line;
seriesMapping.ItemMappings.Add(new ItemMapping("PriceDate", DataPointMember.XValue));
seriesMapping.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
seriesMapping2.ItemMappings.Add(new ItemMapping("PriceDate", DataPointMember.XValue));
seriesMapping2.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
seriesMapping3.ItemMappings.Add(new ItemMapping("PriceDate", DataPointMember.XValue));
seriesMapping3.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
seriesMapping.ItemsSource = hi.OAS;
seriesMapping2.ItemsSource = hi.USDEquivSpread;
seriesMapping3.ItemsSource = hi.Basis;
radOASHistory.SeriesMappings.Add(seriesMapping);
radUSDEquivHistory.SeriesMappings.Add(seriesMapping2);
radBasis.SeriesMappings.Add(seriesMapping3);
}
if (ProcessedOAS != null)
ProcessedOAS(this, new EventArgs());
}
private void ChartArea_ItemToolTipOpening(ItemToolTip2D tooltip, ItemToolTipEventArgs e)
{
}