CanvasLinePlot does not support {Property} stroke because any change to CanvasLinePlot requires calling update for the parent ChartCanvasNode.
In practice, this is causing 2 problems:
(1) I'm constantly forgetting that stroke can't be a Property, and writing code like this that fails an assertion in CanvasLinePlot setStroke:
const sumPlot = new CanvasLinePlot( this.chartTransform, [], {
stroke: FMWColors.sumPlotStrokeProperty
} );
(2) To use a color Property (e.g. a ProfileColorProperty) requires boilerplate like this, which occurs 3x in Fourier:
const somePlot = new CanvasLinePlot( this.chartTransform, [], {
stroke: someStrokeProperty.value
} );
const someChartCanvasNode = new ChartCanvasNode( this.chartTransform, [ somePlot ] );
// CanvasLinePlot stroke does not support Property, so handle updates here.
someStrokeProperty.link( stroke => {
somePlot.setStroke( stroke );
someChartCanvasNode.update();
} );
I don't know how to resolve this, and maybe we don't. But I thought I'd create this issue, and do a little brainstorming, since this API is proving to be a little wonky in practice.
@samreid thoughts?
CanvasLinePlot does not support
{Property} strokebecause any change to CanvasLinePlot requires callingupdatefor the parent ChartCanvasNode.In practice, this is causing 2 problems:
(1) I'm constantly forgetting that
strokecan't be a Property, and writing code like this that fails an assertion in CanvasLinePlotsetStroke:(2) To use a color Property (e.g. a
ProfileColorProperty) requires boilerplate like this, which occurs 3x in Fourier:I don't know how to resolve this, and maybe we don't. But I thought I'd create this issue, and do a little brainstorming, since this API is proving to be a little wonky in practice.
@samreid thoughts?