Charts icon indicating copy to clipboard operation
Charts copied to clipboard

Interact with legend and display the selected data in line chart

Open Huang-Libo opened this issue 10 years ago • 12 comments

Can Charts do the job below ?

#1. Just like the picture below, by default three legends are selected and displayed on line chart, then user can tap at legend to highlight some legends and append new data at line chart. #2. If user tap at line chart to select a day (x value), it will display today's (x value's) associated title and value in the center of line chart.

img_2920 img_2921 img_2922

Huang-Libo avatar Aug 10 '16 08:08 Huang-Libo

Displaying that black box in the middle - is possible by implementing a custom Marker. (In v3 this also becomes much more easier).

Interactive legends are not yet supported - but are a nice feature request.

danielgindi avatar Aug 10 '16 08:08 danielgindi

@danielgindi If I can get each legend's container(UILabel?) , then I can add gesture to interact with legend.

Huang-Libo avatar Aug 10 '16 08:08 Huang-Libo

It's not a label - it's dynamically rendered. But the sizes are available internally. There's a function that calculates the expected layout, and then the renderer uses it to render. Since it is now implemented this way for a few months already - it makes it much easier to make the legend interactive.

We've thought about using layers - but it over complicates stuff, as we might change the rendering engine from CoreGraphics to something else in the future. I'm considering SK or a subset of it.

danielgindi avatar Aug 10 '16 08:08 danielgindi

I see. By the way, what is SK?

Huang-Libo avatar Aug 10 '16 08:08 Huang-Libo

@danielgindi I used to use a scroll view to hold the legend, clickable and has synergy with the highlight. I think current legend still has the space issue.

liuxuan30 avatar Aug 12 '16 00:08 liuxuan30

i also highly need this feature for what i am working on. I looked at the code and as @danielgindi mentioned the legends are not distinct UILabels which you can attach recognizers. I don't mind spending time on adding this feature if this is not picked up by anyone else.

just thinking out loud here , is it possible to actually find out where user clicked using "(ChartViewBase *__nonnull)chartView" ?

farshidce avatar Aug 21 '16 23:08 farshidce

I'm also interested in helping add this feature. @farshidce have you made any progress on this?

reallyseth avatar Sep 08 '16 21:09 reallyseth

+1

monkeyRing avatar Nov 09 '16 14:11 monkeyRing

+1

xuyecan avatar Feb 20 '17 06:02 xuyecan

+1

manishpathak99 avatar Jun 06 '17 21:06 manishpathak99

I want to add similar feature . Any progress ?

manishpathak99 avatar Jun 06 '17 21:06 manishpathak99

Is there any progress on this feature?

jlubeck avatar Aug 29 '19 20:08 jlubeck