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
500
How to make Line chart marker not showing value?
posted

I only want to show red dot for each datapoint in the line chart, not value.

Any help is greatly appreciated.

--xaml file---

<Window x:Class="XamChartMarkerVisibility.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" xmlns:igCA="http://infragistics.com/Chart">
    <Grid>
        <Grid.Resources>
            <Style x:Key="NoLabelMarker" TargetType="{x:Type igCA:Marker}">
                <Setter Property="Fill" Value="Black"/>
                <Setter Property="Stroke" Value="Black"/>
                <Setter Property="MarkerSize" Value=".5"/>
                <Setter Property="Foreground" Value="Transparent"/>
            </Style>
           
            <DataTemplate x:Key="dt">
                <Ellipse Width="10" Height="10" Fill="Red" Loaded="MLoad"/>
            </DataTemplate>
        </Grid.Resources>
        <igCA:XamChart Name="ColumnChart2D" Grid.Row="1" >
            <igCA:XamChart.Legend>
                <igCA:Legend Visible="False"/>
            </igCA:XamChart.Legend>

            <!-- Data points -->
            <igCA:XamChart.Series>

                <igCA:Series
          Label="Goal" x:Name="goalSeries1"
          ChartType="line"
          StrokeThickness="0"
          Fill="#FFD70005">
                    <igCA:Series.DataPoints>
                        <igCA:DataPoint Value="0.0" Label="A1" />
                        <igCA:DataPoint Value="0.5" Label="A2"/>
                        <igCA:DataPoint Value="0.8" Label="A3"/>
                        <igCA:DataPoint Value="0.7" Label="A4"/>
                        <igCA:DataPoint Value="0.9" Label="A5"/>
                    </igCA:Series.DataPoints>
                    <igCA:Series.Marker>
                        <igCA:Marker  UseDataTemplate="True" DataTemplate="{StaticResource dt}"/>
                    </igCA:Series.Marker>
                    <igCA:Series.Animation>
                        <igCA:Animation BeginTime="00:00:0.75" Duration="00:00:02"/>
                    </igCA:Series.Animation>
                </igCA:Series>

            </igCA:XamChart.Series>
        </igCA:XamChart>
    </Grid>
</Window>

--code behind file:--

 using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;

namespace XamChartMarkerVisibility
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        void MLoad(object sender, RoutedEventArgs e)
        {
            var parent = ((sender as Ellipse).TemplatedParent as ContentPresenter).Parent;
            if ((sender as Ellipse).TranslatePoint(new Point(0,0),parent as UIElement).Y == 
                ((parent as FrameworkElement).ActualHeight ))
            {
                (sender as Ellipse).Opacity = 0;
            }
        }
    }
}

 

Parents Reply Children
No Data