thekeenant / fcharts

:bar_chart: Create beautiful, responsive, animated charts using a simple and intuitive API.
https://pub.dartlang.org/packages/fcharts
MIT License
326 stars 46 forks source link

Is it possible to draw value label on point with line chart? #29

Closed fengqiangboy closed 5 years ago

fengqiangboy commented 5 years ago

Is it possible to draw value label on point with line chart?

Mark point with value label

thekeenant commented 5 years ago

No, there is no API available for labeling the points in this library unfortunately. However, you could do something like this, adapted from the city example. See LabeledMarkerShape. This is hacky and I would not recommend it for obvious reasons (counter is outside of the state, no guarantee it will be indexed properly, and this method of drawing text may be out of bounds in some cases). I do welcome PRs to support drawing the value label.

image

RedSevenMale commented 5 years ago

how can i find LabeledMarkerShape?i want to get this effect above adapted from the city example

thekeenant commented 5 years ago

@RedSevenMale It's in the Gist I linked earlier: https://gist.github.com/thekeenant/fb83599813df95787b56fc2e4dfd6b5d

It is a custom MarkerShape I made for the purpose of the demonstration. But I would recommend checking out charts_flutter, they might have a solution that isn't so hacky.