To increase the performance in C1Chart for WPF, Line and Symbol Charts, containing large amount of data one can set the DataSeries.RenderMode property to RenderMode.Bitmap. However, on setting the RenderMode to Bitmap the Data point labels, tooltips and PlotElementLoaded event are not available. This blog explains an approach to show ToolTips in a Scatter Chart with RenderMode set to 'Bitmap' : The ToolTips here are implemented using the ChartPanelObject and adding the ChartPanel as a Layer in the chart.
Let's have a look at the steps being taken to accomplish the same :
Here is the complete code for the above implementation :
var pnl = new ChartPanel();
var obj = new ChartPanelObject()
{
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Bottom
};
var bdr = new Border()
{
Background = new SolidColorBrush(Colors.Blue) { Opacity = 0.6 },
BorderBrush = new SolidColorBrush(Colors.Blue),
BorderThickness = new Thickness(1, 1, 3, 3),
CornerRadius = new CornerRadius(6, 6, 0, 6),
Padding = new Thickness(3)
};
var sp = new StackPanel();
var tb1 = new TextBlock();
var bind1 = new Binding();
bind1.Source = obj;
bind1.StringFormat = "x={0:#.##}";
bind1.Path = new PropertyPath("DataPoint.X");
tb1.SetBinding(TextBlock.TextProperty, bind1);
var tb2 = new TextBlock();
var bind2 = new Binding();
bind2.Source = obj;
bind2.StringFormat = "y={0:#.##}";
bind2.Path = new PropertyPath("DataPoint.Y");
tb2.SetBinding(TextBlock.TextProperty, bind2);
sp.Children.Add(tb1);
sp.Children.Add(tb2);
bdr.Child = sp;
obj.Content = bdr;
obj.DataPoint = new Point();
obj.Action = ChartPanelAction.MouseMove;
obj.Attach = ChartPanelAttach.DataXY;
pnl.Children.Add(obj);
chart.View.Layers.Add(pnl);