Skip to content
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

Add a property value to expose the data specified in the selection property. #155

Open
ahrobinson opened this issue Sep 23, 2016 · 3 comments
Assignees

Comments

@ahrobinson
Copy link

I am listening for the google-chart-select event, but it is passing back the raw chart object. Is there any way to grab the data from the selection?

@wesalvaro
Copy link
Member

I'm not sure what you mean. You can see exactly what you want (I believe) in the google-chart demo page. See the "area selection" demo. Or did you mean something else?

@ahrobinson
Copy link
Author

I meant like if you click a slice of the pie like in the "area selection" instead of getting the row, I would be able to get the actual data for the slice (i.e. Jan, 31(17.1%)).

I ended up finding the actual chart within the raw chart data and being able to get the data back. Inside my Polymer element:

scrshot

Is this the proper way to do this?

@wesalvaro
Copy link
Member

wesalvaro commented Oct 11, 2016

I see your predicament. You should not be referencing those compiled properties (['J']['J']). It's presumed you will access to the data specified for the chart.
e.g. (using the rows property):

let chart = e.currentTarget;
chart.rows[chart.selection[0].row];

e.g. (using the data property with a DataTable):

let chart = this.$.myChart;
let value = chart.data.getValue(chart.selection[0].row, 0);

Selection is meant to mirror the selection property of the chart, however, perhaps exposing the actual value via value may be a good idea... My immediate thought about that is that there is probably a performance issue or otherwise a problem with different chart type's selection values... But I can take a look.

@wesalvaro wesalvaro self-assigned this Oct 11, 2016
@wesalvaro wesalvaro changed the title Is there a way to get the data (name, value) when you click a piece of the pie chart? Add a property value to expose the data specified in the selection property. Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants