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
2560
Incorrect tooltips on UltraDataChart
posted

I have tried creating a StackedAreaSeries chart on a TimeXAxis.

Firstly, if I declare the series with ShowDefaultTooltips = true, and then add the stacks to the series, the tooltips do not appear.  I have to set this property after adding the series.  This seems like a bug to me.

Secondly, the tooltips only display values for the last series added.  If I change the X axis to a CategoryXAxis instead of a TimeXAxis, the tooltips show correctly for each series.  This seems like another bug.

Am I doing something incorrectly?

DataTable dt1 = new DataTable();

            dt1.Columns.Add("Date", typeof(DateTime));
            dt1.Columns.Add("Series 1", typeof(int));
            dt1.Columns.Add("Series 2", typeof(int));

            dt1.Rows.Add(new object[] { new DateTime(2021, 1, 1), 1, 4 });
            dt1.Rows.Add(new object[] { new DateTime(2021, 1, 2), 2, 4 });
            dt1.Rows.Add(new object[] { new DateTime(2021, 1, 6), 3, 2 });
            dt1.Rows.Add(new object[] { new DateTime(2021, 1, 15), 4, 2 });
            dt1.Rows.Add(new object[] { new DateTime(2021, 2, 1), 5, 3 });
            dt1.Rows.Add(new object[] { new DateTime(2021, 2, 3), 4, 4 });

            // Time Axis - we only see tooltips on series 1
            var xAxis = new TimeXAxis()
            {
                DataSource = dt1,
                DateTimeMemberPath = "Date",
                LabelsVisible = true,
            };

            //// Category Axis - we see tooltips on both series
            //var xAxis = new CategoryXAxis()
            //{
            //    DataSource = dt1,
            //    Label = "Date",
            //    LabelsVisible = true
            //};

            var yAxis = new NumericYAxis();

            this.ultraDataChart1.Axes.Add(xAxis);
            this.ultraDataChart1.Axes.Add(yAxis);

            var seriesStacked = new StackedAreaSeries()
            {
                XAxis = xAxis,
                YAxis = yAxis,
                DataSource = dt1,
                //ShowDefaultTooltip = true
            };
            var seriesFragment1 = new StackedFragmentSeries()// StepLineSeries()
            {                
                ValueMemberPath = "Series 1",
                Title = "S1"             
            };
            seriesStacked.Series.Add(seriesFragment1);            

            var seriesFragment2 = new StackedFragmentSeries()
            {                
                ValueMemberPath = "Series 2",
                Title = "S2"             
            };
            seriesStacked.Series.Add(seriesFragment2);

            seriesStacked.ShowDefaultTooltip = true;            

            this.ultraDataChart1.Series.Add(seriesStacked);

Lastly, your tags selection code in this forum is crazily frustrating - the dropdown often doesn't clear, making it impossible to continue (because it hides the I'm not a robot checkbox).  I'm using latest Chrome.