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

Allow other data #506

Closed
TolotraRam opened this issue Aug 8, 2017 · 25 comments
Closed

Allow other data #506

TolotraRam opened this issue Aug 8, 2017 · 25 comments

Comments

@TolotraRam
Copy link

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior
Hi I have this as data in a pie chart :
{
'name': 'Carburant Pétrolier VE',
'value': 2306.18,
'filter': 'G33'
},
{
'name': 'Assurance (Prime et Fond de garantie)',
'value': 1537.95,
'filter': 'G69'
}

and on select when i get the data selected it returns only name and value NOT filter, is there a way to get the filter.

Expected behavior
I should get name and value and filter

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • ngx-charts version: x.x.x
    6.0.0

  • Angular version: 2.x.x

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]
@marjan-georgiev
Copy link
Member

marjan-georgiev commented Aug 17, 2017

I was thinking about putting all extra data that we want to pass in click/tooltip events in a separate property. So the data would look like this:

{
  'name': 'Carburant Pétrolier VE',
  'value': 2306.18,
  'data' : {
    'filter': 'G33'
  },
  ...
},
{
  'name': 'Assurance (Prime et Fond de garantie)',
  'value': 1537.95,
  'data' : {
    'filter': 'G33'
  },
  ...
}

This way, everything you would like to pass in those events (in addition to the name and value properties) should be put under data. Does that make sense?

Update 19 August 2019

This feature has been implemented and available since version 12.0.0. Instead of data, the property is called extra
The format now looks like this:

{
  'name': 'Assurance (Prime et Fond de garantie)',
  'value': 1537.95,
  'extra' : {
    'filter': 'G33'
  }
}

@TolotraRam
Copy link
Author

Yes that make sense, can't wait for it .

@dvschnitz
Copy link

Are there any news about the feature? I'm really looking forward to it, since this would make everything so much easier.

@mpraksti1
Copy link

Bump, really need this feature. Hope it's still in the works!

@mpraksti1
Copy link

This is REALLY hacky and requires jquery(not sure what else to use but their index() method) but I got to my meta data in the following fashion:

onSelectClick(event) {
  const currentTargetIndex = $(event.target.parentElement).index();
  console.log(this.barChartData[currentTargetIndex].meta);
}

@ludcila
Copy link

ludcila commented Oct 21, 2017

I agree, this feature is necessary for creating more complex interactive charts

@ludcila
Copy link

ludcila commented Oct 21, 2017

Looks like for the simpler charts like bar charts and pie charts, you can add an extra property that can be retrieved in the click event
#303
{ name: '2010', value: 40632, extra: 'hello' }
Are there any plans to enable this for the other charts?

@stewones
Copy link

I'm looking for an extra field that can be assigned and retrieved in seriesTooltipTemplate, is that possible?

thanks for this awesome lib

@enkore
Copy link

enkore commented Jun 3, 2018

This would be really sweet and enable some cool use cases. Think for example about a heat-map of events where simply hovering/clicking any given minute/hour/day/week gives you a tooltip with more details (what event types caused the hotspot? did they have a common source? etc.) – see something extraordinary? -> knowing what happened is just one click away.

@furkanilhan
Copy link

It is not working on line chart @marjan-georgiev

@UltraKenchie
Copy link

Bump, any news about this issue? Would be great if this is added.

@roughbits01
Copy link

Please add this my boss is gonna kill me :D

@finebalancetech
Copy link

Bump, yes please!

@enkore
Copy link

enkore commented Nov 27, 2018

Bump please, yes!

@jekuhns
Copy link

jekuhns commented Dec 11, 2018

Another bump, really necessary feature, yes please.

@renathy
Copy link

renathy commented Dec 13, 2018

+1

2 similar comments
@mdroz8
Copy link

mdroz8 commented Jan 7, 2019

+1

@nicolongobardo
Copy link

+1

@annmarie-switzer
Copy link

I just wanted to throw in my vote that this gets added to the Tree chart, as well. Or possibly at least let Tree chart support the 'extra' property like Bar and Pie charts, do.

@SzymonGalazka
Copy link

+1

@sebastiangug
Copy link

Would definitely love this as well 🗡

@ripley
Copy link

ripley commented Aug 19, 2019

It's very disappointing that this is never addressed ...

@marjan-georgiev
Copy link
Member

This has been added and released in v12.0.0 via #1185

I missed closing this ticket, my bad.

The property is called extra instead of data as described above.
The format now looks like this:

{
  'name': 'Assurance (Prime et Fond de garantie)',
  'value': 1537.95,
  'extra' : {
    'filter': 'G33'
  }
}

You can try it on the demo page by clicking any of the bars on the bar chart.

@ripley
Copy link

ripley commented Aug 20, 2019

@marjan-georgiev

Thank you for the information, I checked the demo page but looks like the extra field only available for bar chart and pie chart there, in my line chart it doesn't work, could you please confirm if it's there for line chart?

This has been added and released in v12.0.0 via #1185

I missed closing this ticket, my bad.

The property is called extra instead of data as described above.
The format now looks like this:

{
  'name': 'Assurance (Prime et Fond de garantie)',
  'value': 1537.95,
  'extra' : {
    'filter': 'G33'
  }
}

You can try it on the demo page by clicking any of the bars on the bar chart.

@ghost
Copy link

ghost commented Nov 25, 2022

How do I access this extra value?

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