From 8781ba96f24d2b109e8bde5ef270f041862d9590 Mon Sep 17 00:00:00 2001 From: paleface001 Date: Fri, 27 Mar 2020 12:13:52 +0800 Subject: [PATCH] fix: liquid position --- src/plots/density-heatmap/layer.ts | 11 ++--------- src/plots/gauge/options.ts | 13 +++++++++++-- src/plots/liquid/geometry/shape/liquid.ts | 3 ++- src/plots/liquid/layer.ts | 12 ++++-------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/plots/density-heatmap/layer.ts b/src/plots/density-heatmap/layer.ts index 6093cce11b..7cb5dd8a5b 100644 --- a/src/plots/density-heatmap/layer.ts +++ b/src/plots/density-heatmap/layer.ts @@ -10,14 +10,7 @@ import { HeatmapLegendConfig } from './components/legend'; import { HeatmapBackgroundConfig } from './components/background'; import { getPlotComponents } from './components'; import * as EventParser from './event'; - -interface PointStyle { - lineDash?: number[]; - lineWidth?: number; - opacity?: string; - fillStyle?: string; - strokeStyle?: string; -} +import { GraphicStyle } from '../../interface/config'; export interface DensityHeatmapViewConfig extends ViewConfig { colorField: string; @@ -28,7 +21,7 @@ export interface DensityHeatmapViewConfig extends ViewConfig { shape?: string; size?: number; color?: string; - style?: PointStyle; + style?: GraphicStyle; }; legend?: HeatmapLegendConfig; background?: HeatmapBackgroundConfig; diff --git a/src/plots/gauge/options.ts b/src/plots/gauge/options.ts index bb6019bab9..549248ccb7 100644 --- a/src/plots/gauge/options.ts +++ b/src/plots/gauge/options.ts @@ -16,19 +16,28 @@ interface GaugeStyle { pointerColor?: string; } +interface GaugeStatistic { + visible?: boolean; + position?: [string, string]; + size?: number; + text?: string; + color?: string; +} + export interface GaugeViewConfig extends ViewConfig { startAngle?: number; endAngle?: number; min?: number; max?: number; value?: number; - showValue?: boolean; + /** @ignore */ format?: (...args: any[]) => string; + /** @ignore */ gaugeStyle?: GaugeStyle; range?: number[]; /** @ignore */ styleMix?: any; - statistic?: any; + statistic?: GaugeStatistic; } /** diff --git a/src/plots/liquid/geometry/shape/liquid.ts b/src/plots/liquid/geometry/shape/liquid.ts index 43af3717ce..f8786cffdd 100644 --- a/src/plots/liquid/geometry/shape/liquid.ts +++ b/src/plots/liquid/geometry/shape/liquid.ts @@ -261,7 +261,8 @@ registerShape('interval', 'liquid-fill-gauge', { } sumX += p.x; }); - const cx = sumX / cfg.points.length; + //const cx = sumX / cfg.points.length; + const cx = 0.5; const cp = this.parsePoint({ x: cx, y: cy }); const minP = this.parsePoint({ x: minX, y: 0.5 }); const xWidth = cp.x - minP.x; diff --git a/src/plots/liquid/layer.ts b/src/plots/liquid/layer.ts index 11dc323e72..29146efe6a 100644 --- a/src/plots/liquid/layer.ts +++ b/src/plots/liquid/layer.ts @@ -43,6 +43,7 @@ export interface LiquidLayerConfig extends LiquidViewConfig, LayerConfig { export default class LiquidLayer extends ViewLayer { public static getDefaultOptions(): Partial { const cfg: Partial = { + padding: [0, 0, 0, 0], animation: { factor: 0.4, easing: 'easeExpOut', @@ -176,16 +177,10 @@ export default class LiquidLayer