Skip to content

Issue printing chart with custom Legend  #1031

@upadhb

Description

@upadhb

I do not know if this would be a bug or a feature request, so I apologize if I am posting this at the wrong forum.

I am customizing the Legend using the formatter to return a block of an element as such:

formatter: (seriesName, opts) => {
                            return [`<span class="legend__value">${opts.w.globals.series[opts.seriesIndex]}
                                (${getPercent(this.chartData, opts.w.globals.series[opts.seriesIndex])})</span>
                                <div class="legend__title">${seriesName}</div>`];
                        },

Also tried it this way:

formatter: (seriesName, opts) => {
                            return `<span class="legend__value">${opts.w.globals.series[opts.seriesIndex]}
                                (${getPercent(this.chartData, opts.w.globals.series[opts.seriesIndex])})</span>
                                <div class="legend__title">${seriesName}</div>`;
                        },

The output looks great:
image

The issue is when I try to download the chart.

  • Downloading as PNG doesn't trigger anything neither throws any error.
  • Downloading as SVN downloads a file but I see the below error.
    image

Inspecting the Element shows:
image

I feel this is because of passing html to data:default-text="". Is there something that I am doing wrong, and could I take a different approach to make this work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions