Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Adding ValueOverlay programmatically
posted

Hello,

i'm trying to add ValueOverlay to my chart programmatically, but it only works with xaml code and not code behind.

here my code:

        <ig:XamDataChart Grid.Row="1" x:Name="CategoryDataChart">
                        <ig:XamDataChart.Axes>
                            <ig:NumericYAxis  x:Name="CategoryYAxis" IsInverted="True"/>
                            <ig:CategoryDateTimeXAxis x:Name="CategoryXAxis" Label="{}{Date:dd/MM}"  DateTimeMemberPath="Date">
                                <ig:CategoryDateTimeXAxis.LabelSettings>
                                    <ig:AxisLabelSettings VerticalAlignment="Bottom"
                                                   HorizontalAlignment="Center"
                                                   FontSize="12"
                                                   Location="OutsideBottom"
                                                   Extent="50"
                                                   Angle="30" />
                                </ig:CategoryDateTimeXAxis.LabelSettings>
                            </ig:CategoryDateTimeXAxis>
                        </ig:XamDataChart.Axes>
                        <ig:XamDataChart.Series>
                            <ig:AreaSeries x:Name="series"
                               XAxis="{Binding ElementName=CategoryXAxis}"
                               YAxis="{Binding ElementName=CategoryYAxis}"
                               Outline="#2db4fd"
                               Thickness="2"
                               TrendLineType="CubicFit"
                               TrendLineBrush="Yellow"
                               TrendLineDashArray="5"
                               TrendLineThickness="3"
                               MarkerType="None"
                                  
                               ValueMemberPath="Value" >
                                <ig:AreaSeries.Brush>
                                    <SolidColorBrush>#882db4fd</SolidColorBrush>
                                </ig:AreaSeries.Brush>

                            </ig:AreaSeries>
                            <!--<ig:ValueOverlay Thickness="1"
                                             Title="pricedrop"
                                             Value="70"
                                             Brush="Red"
                                             DashArray="20,2"
                                             Axis="{Binding ElementName=CategoryYAxis}">

                            </ig:ValueOverlay>-->

                        </ig:XamDataChart.Series>

                    </ig:XamDataChart>

here how i'm tryng to add value dinamically:

               

//update itemsource
                CategoryDataChart.Series[0].ItemsSource = dati.Select(a => new TestDataItem { Value = a.Value, Date = ((DateTime)a.Category) }); ;

                ((Infragistics.Controls.Charts.CategoryDateTimeXAxis)CategoryDataChart.Axes[1]).ItemsSource = CategoryDataChart.Series[0].ItemsSource;

//adding OverlayLayer

Infragistics.Controls.Charts.ValueOverlay overlay = new Infragistics.Controls.Charts.ValueOverlay();
                overlay.Axis = this.CategoryYAxis;
                overlay.Value = new Random().Next(60,80);
                overlay.Thickness = 2;
                overlay.Brush = new SolidColorBrush(Colors.Blue);
                this.CategoryDataChart.Series.Add(overlay);

thank you for any help