New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional options for series are not applied in "getSVG" method. #5982

Closed
AlexanderSokolov1 opened this Issue Nov 16, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@AlexanderSokolov1

AlexanderSokolov1 commented Nov 16, 2016

Expected behaviour

All additional options for series and its data points are applied and result svg string contains that changes.

Actual behaviour

Additional options for series are ignored

Live demo with steps to reproduce

http://jsfiddle.net/q6fLodmk/
When you click on "View SVG" button, the series title and data is not changed.

Source

In exporting.src.js file, line 323

// prepare for replicating the chart
options.series = []; // <--- all additional options now removed
each(chart.series, function (serie) {
    seriesOptions = merge(serie.userOptions, { // #4912
        animation: false, // turn off animation
	enableMouseTracking: false,
	showCheckbox: false,
	visible: serie.visible
    });

    if (!seriesOptions.isInternal) { // used for the navigator series that has its own option set
        options.series.push(seriesOptions);
    }
});

Affected browser(s)

All

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Nov 17, 2016

Contributor

Thank for reporting!
I agree, it looks buggy. I don't think changing a data set for an exported chart is a good idea (unless you want to surprise a user ;) ), but for example changing series name should be possible: http://jsfiddle.net/q6fLodmk/2/

Contributor

pawelfus commented Nov 17, 2016

Thank for reporting!
I agree, it looks buggy. I don't think changing a data set for an exported chart is a good idea (unless you want to surprise a user ;) ), but for example changing series name should be possible: http://jsfiddle.net/q6fLodmk/2/

@pawelfus pawelfus added the Bug label Nov 17, 2016

@AlexanderSokolov1

This comment has been minimized.

Show comment
Hide comment
@AlexanderSokolov1

AlexanderSokolov1 Nov 17, 2016

Thank you for replay!
In my case, I have to hide deselected legend items from export, so I use the "showInLegend" series option with the "false" value, when export.
(Also I use the "Pie" chart, where I should set "showInLegend" option for series points like here:
http://jsfiddle.net/sNzrK/.)

I agreed with you about data set (x, y, value and etc. options should not be changed), but I think, that other properties is really useful to change :-).

AlexanderSokolov1 commented Nov 17, 2016

Thank you for replay!
In my case, I have to hide deselected legend items from export, so I use the "showInLegend" series option with the "false" value, when export.
(Also I use the "Pie" chart, where I should set "showInLegend" option for series points like here:
http://jsfiddle.net/sNzrK/.)

I agreed with you about data set (x, y, value and etc. options should not be changed), but I think, that other properties is really useful to change :-).

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Nov 17, 2016

Contributor

Workaround:
Change options inline, using userOptions in the original series object, for example: http://jsfiddle.net/q6fLodmk/3/

Snippet:

// Set new options:
chart.series[0].userOptions.name = "New Series Name";

var svg = chart.getSVG(additionalOptions);
document.body.innerHTML = '<div>' + svg + '</div>';

// Restore option
chart.series[0].userOptions.name = 'Series 1';
Contributor

pawelfus commented Nov 17, 2016

Workaround:
Change options inline, using userOptions in the original series object, for example: http://jsfiddle.net/q6fLodmk/3/

Snippet:

// Set new options:
chart.series[0].userOptions.name = "New Series Name";

var svg = chart.getSVG(additionalOptions);
document.body.innerHTML = '<div>' + svg + '</div>';

// Restore option
chart.series[0].userOptions.name = 'Series 1';
@AlexanderSokolov1

This comment has been minimized.

Show comment
Hide comment
@AlexanderSokolov1

AlexanderSokolov1 Nov 17, 2016

Yeah, workaround is a nice option, but it looks like a hack in the code and "additionalOptions" looses its point.
Anyway, thank you very much for the advice :-).

AlexanderSokolov1 commented Nov 17, 2016

Yeah, workaround is a nice option, but it looks like a hack in the code and "additionalOptions" looses its point.
Anyway, thank you very much for the advice :-).

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