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
300
ScatterLine Missing tooltip for the last point
posted

Hi,  I create a ScatterLine in the chart, and apply tooltip to all data.

But in the chart, the last tooltip is missing, which is very confusion.

 

Please see my attached picture and project for detail

 

 

        <ig:XamChart 

            Name="tnaChart" Theme="IGTheme" Width="Auto" HorizontalAlignment="Stretch"

            Margin="0,0,10,0" VerticalAlignment="Stretch" Height="Auto">

            <ig:XamChart.Caption>

                <ig:Caption Text="{Binding Path=Title}" />

            </ig:XamChart.Caption>

            <ig:XamChart.Series>

                <ig:Series

StrokeThickness="2"

   Label = "{Binding Path=SeriesLabel}"

ChartType="ScatterLine"

DataSource="{Binding Path=DataPoints}"

DataMapping="ValueX = Date;ValueY = Value; ToolTip = ToolTip">

                </ig:Series>

            </ig:XamChart.Series>

        </ig:XamChart>

 

 

    public partial class MainWindow : Window

    {

        public MainWindow()

        {

            InitializeComponent();

            var testData = new TestData {DataPoints = new List<DataPoint>()};

            var random = new Random();

            var start = new DateTime(1983, 2, 3);

            for (int i = 0; i < 20; i++ , start = start.AddDays(1))

            {

                testData.DataPoints.Add(new DataPoint

                                            {

                                                Date = start,

                                                Value = start.ToOADate() + random.Next()

                                            });

            }

            this.DataContext = testData;

        }

    }

 

 

    class TestData

    {

        public string SeriesLabel { get { return "Tooltip Test"; } }

 

        public List<DataPoint> DataPoints { get; set; }

 

        public DateTime LastDate

        {

            get { return DataPoints.Max(d => d.Date); }

        }

 

        public string Title

        {

            get { return "The Last Date is: " + LastDate.ToShortDateString(); }

        }

    }

 

    class DataPoint

    {

        public DateTime Date { get; set; }

        public double Value { get; set; }

        public string ToolTip

        {

            get { return String.Format("Date:  {0:MM/dd/yyyy}\r\nTNA:  {1:c2}", Date, Value); }

        }

 

    }

Parents
No Data
Reply
  • 17559
    posted

    Hello minqin,

     

    I can see the issue that you are describing and I believe that this is caused because by default our XamChart shows the value of the start point of the line as tooltip value. This is why in your case the tooltip for the last point is never reached. If you want to show it I can suggest you set a marker for your series as follows:

                        <ig:Series.Marker>

                            <ig:Marker MarkerSize="0.3"  Foreground="Transparent"/>

                        </ig:Series.Marker>

     

    This way the tooltip value will be changed when the mouse is over the marker.

     

    Furthermore I can suggest you have a look at our XamDataChart which may be more suitable for your scenario since in it by default the tooltip value is recalculated when the mouse pointer is placed at the middle of the line.

     

    If you have any further questions on this matter, please do not hesitate to ask.

Children