robinhood / spark

A simple Android sparkline chart view.
Apache License 2.0
1.27k stars 157 forks source link

Add support for multiple lines (comparison) #23

Closed zoltish closed 8 years ago

zoltish commented 8 years ago

It would be awesome to be able to display different datasets simultaneously. Imagine viewing your bodyweight measurements through a graph like this, and being able to also see how your waistline has progressed during the same time frame.

Theoretically this would be possible by just laying out multiple SparkViews on top of each other, but I would much rather have the SparkView directly draw them (1 view vs many).

Would love to hear your feedback on this so that I can know how to proceed with my ideas.

danh32 commented 8 years ago

It's a cool idea, and one that we had considered before. For the sake of simplicity, we omitted from the initial release. The main problem is all the additional questions that pop up, like how would we configure line colors, widths, etc on each line separately? How do we handle scrubbing events when lines overlap? How does the appearance animation work? What does the fill attribute do? All the additional complexity to the api is likely not worth the trade-off.

I'll try to give this some more thought soon, but my initial thoughts are still that we don't want to support this directly in the library.

danh32 commented 8 years ago

After mulling it over a bit more, I don't think we'll be supporting this. The api surface explosion here isn't worth the tradeoff for most users who just want a single line.

You're right that overlaying the views isn't the most efficient approach, so I'd encourage you to either subclass SparkView and try to do your own thing in onDraw, or fork Spark completely and modify it to suit your needs.

zoltish commented 8 years ago

I completely understand and support your decision!