Closed TomBell-Trove closed 1 year ago
Hi @TomBell-Trove, Dashed lines are not supported yet, but we'll make sure to support them in the API. Thanks for your suggestion!
Unfortunately, it turns out that the dashed line support in LineSpec
won’t be directly supported by the API.
Due to the fact that the line Path
object is constructed only for visible parts of the chart, there is a problem with dashes changing their position on a horizontal scroll.
As of now, I can’t think of a reliable solution for this problem other than always constructing a whole path object. But this will hurt performance for large, and scrollable line charts. We want to avoid that.
With #205 the API of both LineChart
and ColumnChart
will be more open for extensions.
Depending on your use case you may decide to construct the whole line path by overriding or replacing forEachPointWithinBoundsIndexed
function in LineChart
, so it does not check the visible bounds.
The linePaint
in LineSpec
is already protected
, and derived classes can edit its properties.
Unfortunately, it turns out that the dashed line support in
LineSpec
won’t be directly supported by the API. Due to the fact that the linePath
object is constructed only for visible parts of the chart, there is a problem with dashes changing their position on a horizontal scroll. As of now, I can’t think of a reliable solution for this problem other than always constructing a whole path object. But this will hurt performance for large, and scrollable line charts. We want to avoid that.With #205 the API of both
LineChart
andColumnChart
will be more open for extensions. Depending on your use case you may decide to construct the whole line path by overriding or replacingforEachPointWithinBoundsIndexed
function inLineChart
, so it does not check the visible bounds. ThelinePaint
inLineSpec
is alreadyprotected
, and derived classes can edit its properties.
@Gowsky Can you provide an example for a dashed line in the current alpha version or post a code snippet?
Thanks for the neat lib. I'm investigating using this but have come across a problem, how to create a dashed line in a linegraph?
I see that
LineSpec
uses a paint object, but there's no setter for it. Furthermore it'sfinal
so I can't just make my ownDashedLineSpec
.Is there a method for modifying this paint object or some other way of creating a dashed line I haven't noticed?
If not, could you please make
linePaint
open, or put it in the constructor? 😇