Shared Tooltip Shows Wrong Values for Empty Categories in Grouped Column Chart

Check out this runnable sample for this question:

https://blazorplayground.syncfusion.com/hNVSNFNoFLRXWygV

• Only "Alpha" has a value for "08/05-AM", but when hovering over "Alpha", it additionally shows "Gamma" and "Beta" with values from its neighboring columns. This is unexpected

• I expect the tooltip to show only "Alpha" and its value and not category names whose values are null.

How can I fix this so the tooltip only shows "Alpha" and its value, and not show values from other categories it doesn't even have values for?


Thanks.


3 Replies 1 reply marked as answer

AR AbubuckerSittiq RajaMohamed Syncfusion Team August 6, 2025 08:28 AM UTC

Hi Ashish,

We have reviewed the scenario you reported, and it has been identified as the default behavior of the shared tooltip in our chart component. When the current range does not contain a data point for other series, the tooltip displays the nearest data point from those series.

To disable this feature, you can set the "ShowNearestPoint" property in the ChartTooltipSettings API to false, as shown in the code snippet below:

<ChartTooltipSettings Enable="true" Shared="true" Header="<b>${point.x}</b>" ShowNearestPoint="false" EnableHighlight="true" />

For the updated sample details, please refer to the link provided below: Syncfusion Blazor Playground: Write,Edit,Compile, Share Code

Feel free to contact us if you have any questions.

Regards,

Abubucker Sittiq R


Marked as answer

AK Ashish Khanal August 6, 2025 05:47 PM UTC

Thank you Abubucker.

That solved the issue for me!

Just pasting the final code here that I can run in https://blazorplayground.syncfusion.com/ for future reference:

@using Syncfusion.Blazor.Charts

<h3>Minimal Repro: Shared Tooltip Shows Wrong Values for Empty Categories</h3>

<SfChart Title="Grouped Column Chart Tooltip Issue" Width="700px" Height="400px">
    <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" Interval="1" />
    <ChartPrimaryYAxis Title="Value" />
    <ChartSeriesCollection>
        @foreach (var info in SeriesInfos.OrderBy(s => s.Order))
        {
            <ChartSeries DataSource="@ChartPoints.Where(p => p.Series == info.Name)"
                         XName="Category"
                         YName="Value"
                         Name="@info.Name"
                         Fill="@info.Color"
                         Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column">
            </ChartSeries>
        }
    </ChartSeriesCollection>
    <ChartLegendSettings Visible="true" />
    <ChartTooltipSettings Enable="true" Shared="true" Header="<b>${point.x}</b>" ShowNearestPoint="false" EnableHighlight="true" />
</SfChart>

@code {
    // Series info
    private List<SeriesInfo> SeriesInfos = new()
    {
        new SeriesInfo("Gamma", "#a5a5a5", 1),
        new SeriesInfo("Beta", "#ed7d31", 2),
        new SeriesInfo("Alpha", "#4472c4", 3)
    };

    // Chart points: some series are missing values for some date-AM/PM categories
    private List<DataPoint> ChartPoints = new()
    {
        // Only Alpha has "08/05-AM" value
        new DataPoint("08/05-AM", "Gamma", null),
        new DataPoint("08/05-AM", "Beta", null),
        new DataPoint("08/05-AM", "Alpha", 10),

        new DataPoint("08/05-PM", "Gamma", 12),
        new DataPoint("08/05-PM", "Beta", 15),
        new DataPoint("08/05-PM", "Alpha", 20),

        new DataPoint("08/06-PM", "Gamma", 22),
        new DataPoint("08/06-PM", "Beta", 25),
        new DataPoint("08/06-PM", "Alpha", 30),

        // Only Beta and Gamma have "08/07-AM"
        new DataPoint("08/07-AM", "Gamma", 32),
        new DataPoint("08/07-AM", "Beta", 35),
        new DataPoint("08/07-AM", "Alpha", null)
    };

    public record SeriesInfo(string Name, string Color, int Order);
    public class DataPoint
    {
        public DataPoint(string category, string series, double? value)
        {
            Category = category;
            Series = series;
            Value = value;
        }
        public string Category { get; set; }
        public string Series { get; set; }
        public double? Value { get; set; }
    }
}


DG Durga Gopalakrishnan Syncfusion Team August 7, 2025 06:29 AM UTC

Most welcome. We are glad to hear that the solution worked for you! Thank you for sharing the final code snippet for future reference. It’s great to see your proactive approach, and this will surely be helpful for others facing similar scenarios.


If you have any further questions or need assistance with anything else, feel free to reach out. We're always here to help!


Loader.
Up arrow icon