zz-chart
Advanced tools
Comparing version 0.1.1-beta.38 to 0.1.1-beta.39
@@ -9,3 +9,3 @@ import { AxisOpt } from '../types/index.js'; | ||
axes: { | ||
values: ((_u: import("uplot"), splits: string[]) => string[]) | (string | number)[][]; | ||
values: (string | number)[][] | ((_u: import("uplot"), splits: string[]) => string[]); | ||
}[]; | ||
@@ -12,0 +12,0 @@ }; |
@@ -524,3 +524,3 @@ import { View } from '../../chart/view.js'; | ||
values?: import("uplot").Series.Values; | ||
paths: import("uplot").Series.PathBuilder | import("uplot").Series.Points.PathBuilder; | ||
paths: import("uplot").Series.Points.PathBuilder | import("uplot").Series.PathBuilder; | ||
facets?: import("uplot").Series.Facet[]; | ||
@@ -564,3 +564,3 @@ stroke: import("uplot").Series.Stroke; | ||
values?: import("uplot").Series.Values; | ||
paths: import("uplot").Series.PathBuilder | import("uplot").Series.Points.PathBuilder; | ||
paths: import("uplot").Series.Points.PathBuilder | import("uplot").Series.PathBuilder; | ||
facets?: import("uplot").Series.Facet[]; | ||
@@ -605,3 +605,3 @@ stroke: import("uplot").Series.Stroke; | ||
values?: import("uplot").Series.Values; | ||
paths: import("uplot").Series.PathBuilder | import("uplot").Series.Points.PathBuilder; | ||
paths: import("uplot").Series.Points.PathBuilder | import("uplot").Series.PathBuilder; | ||
facets?: import("uplot").Series.Facet[]; | ||
@@ -648,3 +648,3 @@ stroke: import("uplot").Series.Stroke; | ||
values?: import("uplot").Series.Values; | ||
paths: import("uplot").Series.PathBuilder | import("uplot").Series.Points.PathBuilder; | ||
paths: import("uplot").Series.Points.PathBuilder | import("uplot").Series.PathBuilder; | ||
facets?: import("uplot").Series.Facet[]; | ||
@@ -651,0 +651,0 @@ stroke: import("uplot").Series.Stroke; |
@@ -27,2 +27,3 @@ /// <reference types="react" resolution-mode="require"/> | ||
renderLabel(): void; | ||
redraw(): void; | ||
} |
@@ -159,3 +159,3 @@ import { select } from 'd3'; | ||
const { colors } = this.option; | ||
const { text, description, position, textStyle } = this.option.label; | ||
const { text, description, position, textStyle, descriptionStyle } = this.option.label; | ||
const isColors = !!colors?.length; | ||
@@ -172,2 +172,4 @@ if (!this.pieGuide) { | ||
const cH = ww < height ? 0 : (ww - height) / 2; | ||
const textColor = textStyle?.color || this.ctrl.getTheme().gauge.textColor; | ||
const descriptionColor = descriptionStyle?.color || this.ctrl.getTheme().gauge.descriptionColor; | ||
if (description) { | ||
@@ -179,3 +181,4 @@ const centerDesc = this.pieDescription | ||
.attr('y', ww - cH + (position?.y || 0) + cH / (isColors ? 1.2 : 5)) | ||
.attr('stroke', textStyle?.color || this.ctrl.getTheme().gauge.textColor); | ||
.attr('stroke', descriptionColor) | ||
.attr('fill', descriptionColor); | ||
const fontSize = Math.min(clientWidth, clientHeight) / 15; | ||
@@ -194,3 +197,4 @@ const data = this.getData(); | ||
.attr('y', ww - cH + (position?.y || 0) + (isColors ? 0 : -(cH / 2))) | ||
.attr('stroke', textStyle?.color || this.ctrl.getTheme().gauge.textColor); | ||
.attr('stroke', textColor) | ||
.attr('fill', textColor); | ||
const fontSize = Math.min(clientWidth, clientHeight) / 8; | ||
@@ -205,2 +209,15 @@ const data = this.getData(); | ||
} | ||
redraw() { | ||
const { textStyle, descriptionStyle } = this.option.label; | ||
if (this.pieDescription) { | ||
const descriptionColor = descriptionStyle?.color || this.ctrl.getTheme().gauge.descriptionColor; | ||
this.pieDescription | ||
.attr('stroke', descriptionColor) | ||
.attr('fill', descriptionColor); | ||
} | ||
if (this.pieGuide) { | ||
const textColor = textStyle?.color || this.ctrl.getTheme().gauge.textColor; | ||
this.pieGuide.attr('stroke', textColor).attr('fill', textColor); | ||
} | ||
} | ||
} | ||
@@ -207,0 +224,0 @@ function calculatePaths(data, option, color, angleMin) { |
@@ -42,2 +42,3 @@ /// <reference types="react" resolution-mode="require"/> | ||
abstract render(): void; | ||
abstract redraw(): void; | ||
constructor(ctrl: View, opt?: {}); | ||
@@ -44,0 +45,0 @@ getData(): import("../../types/options.js").Data; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="web" /> | ||
import { View } from '../../chart/view.js'; | ||
@@ -528,3 +527,3 @@ import { ShapeOptions } from '../../types/options.js'; | ||
values?: import("uplot").Series.Values; | ||
paths: import("uplot").Series.PathBuilder | import("uplot").Series.Points.PathBuilder; | ||
paths: import("uplot").Series.Points.PathBuilder | import("uplot").Series.PathBuilder; | ||
facets?: import("uplot").Series.Facet[]; | ||
@@ -568,3 +567,3 @@ stroke: import("uplot").Series.Stroke; | ||
values?: import("uplot").Series.Values; | ||
paths: import("uplot").Series.PathBuilder | import("uplot").Series.Points.PathBuilder; | ||
paths: import("uplot").Series.Points.PathBuilder | import("uplot").Series.PathBuilder; | ||
facets?: import("uplot").Series.Facet[]; | ||
@@ -609,3 +608,3 @@ stroke: import("uplot").Series.Stroke; | ||
values?: import("uplot").Series.Values; | ||
paths: import("uplot").Series.PathBuilder | import("uplot").Series.Points.PathBuilder; | ||
paths: import("uplot").Series.Points.PathBuilder | import("uplot").Series.PathBuilder; | ||
facets?: import("uplot").Series.Facet[]; | ||
@@ -652,3 +651,3 @@ stroke: import("uplot").Series.Stroke; | ||
values?: import("uplot").Series.Values; | ||
paths: import("uplot").Series.PathBuilder | import("uplot").Series.Points.PathBuilder; | ||
paths: import("uplot").Series.Points.PathBuilder | import("uplot").Series.PathBuilder; | ||
facets?: import("uplot").Series.Facet[]; | ||
@@ -655,0 +654,0 @@ stroke: import("uplot").Series.Stroke; |
@@ -48,2 +48,3 @@ /// <reference types="react" resolution-mode="require"/> | ||
renderLabel(): void; | ||
redraw(): void; | ||
} | ||
@@ -50,0 +51,0 @@ export declare function getPath(config: { |
@@ -124,2 +124,3 @@ import { select } from 'd3'; | ||
} | ||
redraw() { } | ||
} | ||
@@ -126,0 +127,0 @@ export function getPath(config) { |
@@ -5,3 +5,3 @@ import { cloneDeep, merge, mergeWith, omit, isFunction, get } from 'lodash'; | ||
import { ChartEvent } from '../types/index.js'; | ||
import { generateName, SHAPE_TYPES } from '../utils/index.js'; | ||
import { generateName, POLAR_SHAPE_TYPES, SHAPE_TYPES } from '../utils/index.js'; | ||
import { ViewStrategy } from './abstract.js'; | ||
@@ -117,2 +117,6 @@ import { UPLOT_DEFAULT_OPTIONS } from './config.js'; | ||
} | ||
POLAR_SHAPE_TYPES.map(name => { | ||
const comp = this.ctrl.shapeComponents.get(name); | ||
comp?.redraw(); | ||
}); | ||
}); | ||
@@ -119,0 +123,0 @@ // 监听 legend item click |
@@ -62,2 +62,3 @@ const COLORS = { | ||
textColor: COLORS['n-1'], | ||
descriptionColor: COLORS['n-2'], | ||
}; | ||
@@ -64,0 +65,0 @@ /** |
@@ -61,3 +61,4 @@ const COLORS = { | ||
const GAUGE = { | ||
textColor: COLORS['n-2'], | ||
textColor: COLORS['n-1'], | ||
descriptionColor: COLORS['n-2'], | ||
}; | ||
@@ -64,0 +65,0 @@ /** |
@@ -160,2 +160,5 @@ /// <reference types="react" resolution-mode="require"/> | ||
}; | ||
descriptionStyle?: { | ||
color?: string; | ||
}; | ||
}; | ||
@@ -162,0 +165,0 @@ text?: { |
@@ -52,2 +52,3 @@ export declare type Theme = LightTheme | DarkTheme | CustomTheme | SystemTheme; | ||
textColor: string; | ||
descriptionColor: string; | ||
} | ||
@@ -54,0 +55,0 @@ export declare type LightTheme = { |
{ | ||
"name": "zz-chart", | ||
"version": "0.1.1-beta.38", | ||
"version": "0.1.1-beta.39", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Alauda Chart components by Alauda Frontend Team", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
918492
21539