class MountainPointMarkerPaletteProvider extends DefaultPaletteProvider {
constructor() {
super();
this.fillPaletteMode = EFillPaletteMode.SOLID;
this.strokePaletteMode = EStrokePaletteMode.SOLID;
this.redStroke = parseColorToUIntArgb('red');
this.blueFill = parseColorToUIntArgb('blue');
}
overridePointMarkerArgb(xValue, yValue, index, opacity, metadata) {
if (yValue >= 0.5) {
// The opacity is already applied in the texture
// And this opacity is the renderable series opacity, therefore we do not use it here
const stroke = this.redStroke;
const fill = this.blueFill;
return { stroke, fill };
}
return undefined;
}
}
// Usage
const mountainSeries = new FastMountainRenderableSeries(wasmContext, {
dataSeries,
stroke: '#4682b4',
strokeThickness: 10,
zeroLineY: 0.0,
fill: 'rgba(176, 196, 222, 1)',
pointMarker: new EllipsePointMarker(wasmContext, {
width: 18,
height: 18,
strokeThickness: 5,
fill: '#ff0000',
stroke: '#000000',
opacity: 1
}),
opacity: 1,
paletteProvider: new MountainPointMarkerPaletteProvider()
});
// PaletteProvider definition
export class MountainPointMarkerPaletteProvider implements IPointMarkerPaletteProvider {
public readonly fillPaletteMode = EFillPaletteMode.SOLID;
public readonly strokePaletteMode = EStrokePaletteMode.SOLID;
private readonly redStroke = parseColorToUIntArgb('red');
private readonly blueFill = parseColorToUIntArgb('blue');
public onAttached(parentSeries: IRenderableSeries): void {}
public onDetached(): void {}
public overridePointMarkerArgb(
xValue: number,
yValue: number,
index: number,
opacity?: number,
metadata?: IPointMetadata
): TPointMarkerArgb {
if (yValue >= 0.5) {
// The opacity is already applied in the texture
// And this opacity is the renderable series opacity, therefore we do not use it here
const stroke = this.redStroke;
const fill = this.blueFill;
return { stroke, fill };
}
return undefined;
}
}
// Usage
const mountainSeries = new FastMountainRenderableSeries(wasmContext, {
dataSeries,
stroke: '#4682b4',
strokeThickness: 10,
zeroLineY: 0.0,
fill: 'rgba(176, 196, 222, 1)',
pointMarker: new EllipsePointMarker(wasmContext, {
width: 18,
height: 18,
strokeThickness: 5,
fill: '#ff0000',
stroke: '#000000',
opacity: 1
}),
opacity: 1,
paletteProvider: new MountainPointMarkerPaletteProvider()
});