Posted 27 August 2018, 5:53 am EST
Hi, I’m using LineSmoothed wpf chart,
I want to display a performance monitoring chart,
I’m able to draw the chart and everything is ok as DynamicChart example,
The below code is my update function:
void Update()
{
chart.BeginUpdate();
int cnt = nAddPoints;
for (int i = 0; i < cnt; i++)
{
//My new point gets it's value from here
double value = rnd.NextDouble();
if (value > chart.View.AxisY.Max)
{
//Detected New Max Value
chart.View.AxisY.Max = value;
}
_pts.Add(new Point(counter++, value));
}
int ndel = _pts.Count - nMaxPoints;
if (ndel > 0)
for (int i = 0; i < ndel; i++)
_pts.RemoveAt(0);
chart.EndUpdate();
}
The AxisY max value is updated when I get bigger value than the current max,
I wanted to add a lable for this new max value to be displayed and noticed
I tried adding ```
Datatemplate
<c1chart:DataPointConverter x:Key="fc" /> <DataTemplate x:Key="lbl"> <Grid> <Path Data="M0.5,0.5 L23,0.5 23,23 11.61165,29.286408 0.5,23 z" Stretch="Fill" Fill="#FFF1F1F1" Stroke="DarkGray" StrokeThickness="1" /> <TextBlock FontSize="10" Margin="5 5 5 15" Foreground="DarkRed" Text="{Binding ConverterParameter=Series: \{#SeriesLabel\}\{#NewLine\}Point: \{#PointIndex\}\{#NewLine\}Value: \{#Value\}, Converter={StaticResource fc}}" /> </Grid> </DataTemplate>
when I modify my ```
XYDataSeries
``` and set it's ```
PointLabelTemplate
``` to ```
(DataTemplate)Resources["lbl"]
``` it's displaying the label for all the points and it becomes a mess!
Please help me with this
Thanks