Pre loader

HOw to combine different type of annotation to chart ?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Dear all,

I have a chart where I display threshold, min and max line annotation as define below :

 <s:SciChartSurface.Annotations>
                <!--Display fix average value cursor annotation-->
                <s:HorizontalLineAnnotation x:Name="_avg" HorizontalAlignment="Stretch"
                                        IsEditable="False" LabelPlacement="Axis" 
                                        LabelTextFormatting="0.00" 
                                        ShowLabel="True"
                                        Style="{DynamicResource AvgAnnotationStyle}"
                                        Y1="{Binding Average,UpdateSourceTrigger=PropertyChanged,
                                                     FallbackValue=0}"  />

                <s:HorizontalLineAnnotation x:Name="_sigmaHight" HorizontalAlignment="Stretch"
                                        LabelPlacement="Axis" 
                                        LabelTextFormatting="0.00" ShowLabel="True"
                                        Style="{DynamicResource SigmaAnnotationStyle}"
                                        Y1="{Binding SigmaHigh,
                                            UpdateSourceTrigger=PropertyChanged,
                                            FallbackValue=0}" />

                <s:HorizontalLineAnnotation x:Name="_sigmaLow" HorizontalAlignment="Stretch"
                                        LabelPlacement="Axis"
                                        LabelTextFormatting="0.00" ShowLabel="True"
                                        Style="{DynamicResource SigmaAnnotationStyle}"
                                        Y1="{Binding SigmaLow,
                                            UpdateSourceTrigger=PropertyChanged,
                                            FallbackValue=0}" />

                <s:HorizontalLineAnnotation x:Name="_threshold" HorizontalAlignment="Stretch"
                                        LabelPlacement="Axis" 
                                        LabelTextFormatting="0.00" ShowLabel="True"
                                        Style="{DynamicResource ThresholdAnnotationStyle}"
                                        Y1="{Binding LiveThreshold,
                                            UpdateSourceTrigger=PropertyChanged,
                                            FallbackValue=0}" />

            </s:SciChartSurface.Annotations>

These works really nicely when I display my chart with Line series.

Then I am using the same component to display my data series as an Histogram with label as defined in your histogram sample.
But the issue I have is that labels for Histogram in your sample show the creation of those dynamically by creating for each bar a TextAnnotation .

Due to that when I change my graph type and try to display the labels, while I have already some annotation define in my XAML for the chart, my histogram labels are not displayed.

If I remove completely the annotation section of my chart then histogram labels gets display but I cannot have anymore my Horizontal line threshold at same time.

What is the best way to get a combination of both ?

Thanks for help
regards

Version
4
  • sc sc
    I find out the issue. It was coming from the fact that the Histogram custom modifier sample was clearing the whol parent surface annotation collection before adding label
  • You must to post comments
0
0

Glad you found the answer,

The Annotations collection on the SciChartSurface stores all annotations from all sources. You have to manage this collection yourself if you are adding annotations from multiple sources.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies