Skip to content
New issue

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

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

Already on GitHub? # to your account

Scattered Chart - Labels for each set of XY #291

Closed
pankajsindagi opened this issue Feb 20, 2018 · 7 comments
Closed

Scattered Chart - Labels for each set of XY #291

pankajsindagi opened this issue Feb 20, 2018 · 7 comments

Comments

@pankajsindagi
Copy link

pankajsindagi commented Feb 20, 2018

Hi,

Currently the labels for each data point in scattered chart is picked from the name of the Y-Axis. It would be excellent feature to have individual labels for each data point. Looking forward for this feature in next release.

Thanks Brent :)

@gitbrent
Copy link
Owner

Hi @pankajsindagi ,

Can you provide an example?

@pankajsindagi
Copy link
Author

When we create ppt slide with below chart type,

// Chart Type: XY SCATTER
var dataChartScatter = [
	{ name:'X-Axis',    values:[1,2,3,4,5,6,7,8,9,10] },
	{ name:'Y-Value 1', values:[13, 20, 21, 25] },
	{ name:'Y-Value 2', values:[21, 22, 25, 49] }
];
slide.addChart( pptx.charts.SCATTER, dataChartScatter, { x:1.0, y:1.0, w:6, h:4 } );

image

When hover on data point, as you can see in above chart. We see the name as label, i.e Y-Value 1. In practical scenarios it would be ideal to have separate label which represents the particular data point i.e (4, 25)

Please consider this helpful feature.

Again, Thanks for the cool library :)

@pankajsindagi
Copy link
Author

pankajsindagi commented Feb 22, 2018

I've data something like this:

var data = [ {label: 'Red 1', x: 1, y:13 },
             {label: 'Red 2', x: 2, y:20 },
             {label: 'Red 3', x: 3, y:21 },
             {label: 'Red 4', x: 4, y:25 } ]

When hover on (4, 25) data point, I would like to see Red 4 as label

@gitbrent
Copy link
Owner

Thanks for the clear examples. Let me see what I can do.

@ReimaFrgos
Copy link
Contributor

I have a working version of this that I'm using for a custom scenario. Currently I'm passing in a completely custom label, but took a quick look, and doesn't appear to involve much effort to support proper use of the X Y labels.

Will need to clean up my code first, then will submit a PR.

For reference, the Labels need to exist on the Y-Value, so applying labels would look like:

var data = [
    { name:'X-Axis',    values:[1,2,3,4] },
    { name:'Y-Value 1', values:[13, 20, 21, 25], labels:['Red 1', 'Red 2', 'Red 3', 'Red 4'] },
    { name:'Y-Value 2', values:[21, 22, 25, 49], labels:['Blue 1', 'Blue 2', 'Blue 3', 'Blue 4'] }
];

@ReimaFrgos
Copy link
Contributor

@gitbrent you should be able to close this issue. Was merged in at start of 2019

@gitbrent
Copy link
Owner

Addressed via Pull #938

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants