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

get other info from source data #443

Open
jacksalici opened this issue Jan 4, 2024 · 3 comments
Open

get other info from source data #443

jacksalici opened this issue Jan 4, 2024 · 3 comments

Comments

@jacksalici
Copy link

Hello, and thank you for this awesome work! I would like to know about the possibility of using data for every row other than the values itself. For instance, when the source is a CSV, I'd like to get all the dict of the single row and use the data of other columns in places like the tooltip or the subdomain text...
Is there a way to achieve this? Thank you in advance.

@wa0x6e
Copy link
Owner

wa0x6e commented Jan 4, 2024

Can you elaborate more with an example of csv content?

@jacksalici
Copy link
Author

Sure, thank you for the interest.

Let's suppose to have the next table like a CSV:

date distance location
2024-1-1 100 "Italy"

Is it possible to get the "location" value in the tooltip and or in the subdomain label?
Let me show you an example with code...

const cal = new CalHeatmap();
cal.paint(
  {
    data: {
      source: 'my.csv',
      type: 'csv',
      x: 'date',
      y: d => +d['distance'], //the y value is for the distance
      groupY: 'max',
    },
    date: { start: new Date('2024-01-01') },
    
    subDomain: { 
         type: 'day', 
         radius: 2, 
         label: (t, v) => {return v['location']} //<= this not works, but i'd like to achieve something like this, where v is the dict of the entire row not only the y value...

     },
    itemSelector: '#ex-year',
  },

I have looked in the docs and I found nothing, I was wondering if there could be some workarounds...

Hope this is a bit clearer, thank you in advance.

@wa0x6e
Copy link
Owner

wa0x6e commented Jan 4, 2024

I see, it’s not possible at the moment, but seems like a good feature to add, will add to todo list

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