Skip to content

Margin setting for legened doesn't work in mixed charts #35029

Closed

Description

@saha23412

Bug description

Although this bug is closed, I encounter it in this version Version: 4.1.1, legend indent setting does not work in mixed chart, orientation and type settings work, when changing legend indent nothing changes, everything stays in place, although legend indent is applied to other charts

  • Example of a bar chart without legend margin:
Image
  • Example of a bar chart with legend margin:
Image

Here the legend margin works, then an example of a mixed diagram:

Image Image

As you can see from the screenshots, the legend margin does not work for mixed chart.

Superset version

4.1.3

Python version

3.9

Node version

16

Browser

Chrome

Additional context

From the frontend side, the code in control.tsx looks like this:

const legendMarginControl: ControlSetItem = { name: 'legendMargin', config: { type: 'TextControl', label: t('Margin'), renderTrigger: true, isInt: true, default: legendMargin, description: t('Additional padding for legend.'), visibility: ({ controls }: ControlPanelsContainerProps) => Boolean(controls?.show_legend?.value), }, };

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Activity

  1. dosubot commented on Sep 5, 2025

    @dosubot

    Hi @saha23412! I'm Dosu and I’m helping the superset team.

    The legend margin setting is not currently applied in mixed charts (MixedTimeseries) due to missing or inconsistent handling in the chart's configuration logic. While legend orientation and type work, the margin setting is not propagated or respected in the mixed chart's option building, unlike in bar or pie charts where recent improvements have been made for legend positioning and margin handling. Recent updates have focused on legend sorting and display, but not on margin or spacing for mixed charts, so this limitation still exists in Superset 4.1.3. You may want to watch for future updates or consider custom code changes if legend margin is critical for your use case.
    Relevant details: PR #34911, PR #34435, PR #35005.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about superset with Dosu Add Dosu to your team

  2. msyavuz commented on Sep 5, 2025

    @msyavuz
    Member

    Hey, @saha23412 Does the mentioned pr #34911 fix this? You can test that on master branch.

  3. SBIN2010 commented on Sep 5, 2025

    @SBIN2010
    Contributor

    Hey, @saha23412 Does the mentioned pr #34911 fix this? You can test that on master branch.

    Hi @msyavuz pr #34911 just adds legend sorting
    Margin legends is indeed missing from MixedTimeseries chart

  4. saha23412 commented on Sep 8, 2025

    @saha23412
    Author

    Thanks, I fixed the code block in the file superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts where null was passed instead of legend margin

    It was like that:

    const chartPadding = getPadding( showLegend, legendOrientation, addYAxisTitleOffset, zoomable, null, addXAxisTitleOffset, yAxisTitlePosition, yAxisTitleCalculatedMargin, xAxisTitleCalculatedMargin, );

    Corrected to:

    const chartPadding = getPadding( showLegend, legendOrientation, addYAxisTitleOffset, zoomable, legendMargin addXAxisTitleOffset, yAxisTitlePosition, yAxisTitleCalculatedMargin, xAxisTitleCalculatedMargin, );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions