jmchart 1.2.15 → 1.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -37
- package/dist/jmchart.amd.js +635 -527
- package/dist/jmchart.cjs.js +635 -527
- package/dist/jmchart.esm.js +635 -527
- package/dist/jmchart.iife.js +635 -527
- package/dist/jmchart.system.js +635 -527
- package/index.d.ts +498 -0
- package/package.json +3 -2
- package/src/common/style.js +0 -21
- package/src/jmChart.js +1 -3
- package/src/series/gaugeSeries.js +12 -10
- package/src/series/lineSeries.js +111 -11
- package/src/series/ringProgressSeries.js +5 -3
- package/src/series/sunburstSeries.js +0 -240
package/index.d.ts
ADDED
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
// Type definitions for jmchart
|
|
2
|
+
// Re-exports jmgraph types and adds chart-specific types
|
|
3
|
+
// =========================================================
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
jmGraph,
|
|
7
|
+
jmGraphOptions,
|
|
8
|
+
jmStyle,
|
|
9
|
+
jmControl,
|
|
10
|
+
jmControlParams,
|
|
11
|
+
jmPath,
|
|
12
|
+
jmList,
|
|
13
|
+
jmUtils,
|
|
14
|
+
Point,
|
|
15
|
+
Bounds,
|
|
16
|
+
} from 'jmgraph';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 图表系列类型
|
|
20
|
+
*/
|
|
21
|
+
export type SeriesType =
|
|
22
|
+
| 'line'
|
|
23
|
+
| 'bar'
|
|
24
|
+
| 'stackBar'
|
|
25
|
+
| 'pie'
|
|
26
|
+
| 'radar'
|
|
27
|
+
| 'stackLine'
|
|
28
|
+
| 'range'
|
|
29
|
+
| 'candlestick'
|
|
30
|
+
| 'scatter'
|
|
31
|
+
| 'bubble'
|
|
32
|
+
| 'heatmap'
|
|
33
|
+
| 'gauge'
|
|
34
|
+
| 'area'
|
|
35
|
+
| 'waterfall'
|
|
36
|
+
| 'funnel'
|
|
37
|
+
| 'ringProgress'
|
|
38
|
+
| 'boxPlot'
|
|
39
|
+
| 'wordCloud';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 轴配置选项
|
|
43
|
+
*/
|
|
44
|
+
export interface AxisOptions {
|
|
45
|
+
type?: 'x' | 'y' | 'radar';
|
|
46
|
+
field?: string;
|
|
47
|
+
dataType?: 'number' | 'date' | 'string';
|
|
48
|
+
visible?: boolean;
|
|
49
|
+
format?: (value: any) => string;
|
|
50
|
+
index?: number;
|
|
51
|
+
zeroBase?: boolean;
|
|
52
|
+
style?: jmStyle;
|
|
53
|
+
minXValue?: number;
|
|
54
|
+
maxXValue?: number;
|
|
55
|
+
minYValue?: number;
|
|
56
|
+
maxYValue?: number;
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 数据点对象
|
|
62
|
+
*/
|
|
63
|
+
export interface DataPoint {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
xValue: any;
|
|
67
|
+
xLabel: any;
|
|
68
|
+
yValue: any;
|
|
69
|
+
yLabel?: any;
|
|
70
|
+
height?: number;
|
|
71
|
+
index: number;
|
|
72
|
+
data: any;
|
|
73
|
+
style?: jmStyle;
|
|
74
|
+
points?: Array<{
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
height: number;
|
|
78
|
+
yValue: any;
|
|
79
|
+
field: string;
|
|
80
|
+
m?: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
m?: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 图表系列选项
|
|
87
|
+
*/
|
|
88
|
+
export interface SeriesOptions {
|
|
89
|
+
type?: SeriesType;
|
|
90
|
+
field?: string | string[];
|
|
91
|
+
fields?: string | string[];
|
|
92
|
+
xField?: string;
|
|
93
|
+
yField?: string;
|
|
94
|
+
index?: number;
|
|
95
|
+
style?: jmStyle;
|
|
96
|
+
color?: string | ((point: DataPoint) => string);
|
|
97
|
+
legendLabel?: string;
|
|
98
|
+
enableAnimate?: boolean;
|
|
99
|
+
graph?: jmChart;
|
|
100
|
+
label?: {
|
|
101
|
+
show?: boolean;
|
|
102
|
+
fill?: string;
|
|
103
|
+
font?: string;
|
|
104
|
+
[key: string]: any;
|
|
105
|
+
};
|
|
106
|
+
itemLabelFormat?: (point: DataPoint) => string;
|
|
107
|
+
initItemHandler?: (point: DataPoint) => void;
|
|
108
|
+
initItem?: (point: DataPoint) => void;
|
|
109
|
+
onInit?: (...args: any[]) => void;
|
|
110
|
+
minYValue?: number;
|
|
111
|
+
maxYValue?: number;
|
|
112
|
+
yLabelFormat?: (value: any) => string;
|
|
113
|
+
lockSide?: Bounds;
|
|
114
|
+
[key: string]: any;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 图表构造选项
|
|
119
|
+
*/
|
|
120
|
+
export interface jmChartOptions extends jmGraphOptions {
|
|
121
|
+
enableAnimate?: boolean;
|
|
122
|
+
data?: any[];
|
|
123
|
+
xField?: string;
|
|
124
|
+
baseY?: number;
|
|
125
|
+
legendVisible?: boolean;
|
|
126
|
+
legendPosition?: string;
|
|
127
|
+
layout?: 'normal' | 'inside';
|
|
128
|
+
xLabelFormat?: (value: any) => string;
|
|
129
|
+
yLabelFormat?: (value: any) => string;
|
|
130
|
+
xAxisOption?: AxisOptions;
|
|
131
|
+
yAxisOption?: AxisOptions;
|
|
132
|
+
minXValue?: number;
|
|
133
|
+
maxXValue?: number;
|
|
134
|
+
minYValue?: number;
|
|
135
|
+
maxYValue?: number;
|
|
136
|
+
touchGraph?: boolean;
|
|
137
|
+
touchCanvas?: HTMLCanvasElement;
|
|
138
|
+
onClick?: (point: DataPoint) => void;
|
|
139
|
+
[key: string]: any;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* 图表默认样式
|
|
144
|
+
*/
|
|
145
|
+
export interface jmChartStyle extends jmStyle {
|
|
146
|
+
layout?: 'normal' | 'inside';
|
|
147
|
+
margin?: {
|
|
148
|
+
left?: number;
|
|
149
|
+
top?: number;
|
|
150
|
+
right?: number;
|
|
151
|
+
bottom?: number;
|
|
152
|
+
};
|
|
153
|
+
itemLabel?: jmStyle;
|
|
154
|
+
markLine?: jmStyle & {
|
|
155
|
+
x?: boolean;
|
|
156
|
+
y?: boolean;
|
|
157
|
+
radius?: number;
|
|
158
|
+
};
|
|
159
|
+
legend?: jmStyle & {
|
|
160
|
+
margin?: {
|
|
161
|
+
left?: number;
|
|
162
|
+
top?: number;
|
|
163
|
+
right?: number;
|
|
164
|
+
bottom?: number;
|
|
165
|
+
};
|
|
166
|
+
width?: number;
|
|
167
|
+
height?: number;
|
|
168
|
+
item?: {
|
|
169
|
+
shape?: { width?: number; height?: number };
|
|
170
|
+
label?: jmStyle;
|
|
171
|
+
normal?: jmStyle;
|
|
172
|
+
hover?: jmStyle;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
chartArea?: jmStyle;
|
|
176
|
+
axis?: jmStyle & {
|
|
177
|
+
x?: boolean;
|
|
178
|
+
y?: boolean;
|
|
179
|
+
grid?: jmStyle & {
|
|
180
|
+
x?: boolean;
|
|
181
|
+
y?: boolean;
|
|
182
|
+
stroke?: string;
|
|
183
|
+
lineType?: 'dotted' | 'solid';
|
|
184
|
+
dashLength?: number;
|
|
185
|
+
};
|
|
186
|
+
align?: 'normal' | 'center';
|
|
187
|
+
xLabel?: jmStyle & {
|
|
188
|
+
count?: number;
|
|
189
|
+
length?: number;
|
|
190
|
+
margin?: { left?: number; top?: number; right?: number; bottom?: number };
|
|
191
|
+
rotation?: { angle: number; point?: Point };
|
|
192
|
+
};
|
|
193
|
+
yLabel?: jmStyle & {
|
|
194
|
+
count?: number;
|
|
195
|
+
length?: number;
|
|
196
|
+
margin?: { left?: number; top?: number; right?: number; bottom?: number };
|
|
197
|
+
rotation?: { angle: number; point?: Point };
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
chartColors?: string[];
|
|
201
|
+
line?: jmStyle;
|
|
202
|
+
stackLine?: jmStyle;
|
|
203
|
+
range?: jmStyle;
|
|
204
|
+
bar?: jmStyle;
|
|
205
|
+
pie?: jmStyle;
|
|
206
|
+
radar?: jmStyle;
|
|
207
|
+
candlestick?: jmStyle;
|
|
208
|
+
scatter?: jmStyle;
|
|
209
|
+
bubble?: jmStyle;
|
|
210
|
+
heatmap?: jmStyle;
|
|
211
|
+
gauge?: jmStyle;
|
|
212
|
+
area?: jmStyle;
|
|
213
|
+
waterfall?: jmStyle;
|
|
214
|
+
funnel?: jmStyle;
|
|
215
|
+
ringProgress?: jmStyle;
|
|
216
|
+
boxPlot?: jmStyle;
|
|
217
|
+
wordCloud?: jmStyle;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 轴类
|
|
222
|
+
*/
|
|
223
|
+
export declare class jmAxis extends jmControl {
|
|
224
|
+
constructor(options?: AxisOptions);
|
|
225
|
+
|
|
226
|
+
field: string;
|
|
227
|
+
dataType: 'number' | 'date' | 'string';
|
|
228
|
+
min(): number;
|
|
229
|
+
max(value?: number): number;
|
|
230
|
+
step(): number;
|
|
231
|
+
labelStart: number;
|
|
232
|
+
clear(): void;
|
|
233
|
+
reset(): void;
|
|
234
|
+
init(options?: AxisOptions): void;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* 图例类
|
|
239
|
+
*/
|
|
240
|
+
export declare class jmLegend extends jmControl {
|
|
241
|
+
constructor(options?: { style?: jmStyle });
|
|
242
|
+
|
|
243
|
+
init(): void;
|
|
244
|
+
reset(): void;
|
|
245
|
+
append(series: jmSeries, shape: jmControl): void;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* 标线管理器
|
|
250
|
+
*/
|
|
251
|
+
export declare class jmMarkLineManager {
|
|
252
|
+
constructor(chart: jmChart);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* 图表系列基类
|
|
257
|
+
*/
|
|
258
|
+
export declare class jmSeries extends jmPath {
|
|
259
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
260
|
+
|
|
261
|
+
option: SeriesOptions & { graph: jmChart };
|
|
262
|
+
field: string | string[];
|
|
263
|
+
index: number;
|
|
264
|
+
legendLabel: string;
|
|
265
|
+
shapes: jmList<jmControl>;
|
|
266
|
+
keyPoints: any[];
|
|
267
|
+
labels: any[];
|
|
268
|
+
baseYHeight: number;
|
|
269
|
+
baseY: number;
|
|
270
|
+
baseYValue: number;
|
|
271
|
+
xAxis: jmAxis;
|
|
272
|
+
yAxis: jmAxis;
|
|
273
|
+
data: any[];
|
|
274
|
+
enableAnimate: boolean;
|
|
275
|
+
dataPoints: DataPoint[];
|
|
276
|
+
curve?: boolean;
|
|
277
|
+
chartInfo?: { xAxis: jmAxis; yAxis: jmAxis };
|
|
278
|
+
|
|
279
|
+
initDataPoint(...args: any[]): { points: DataPoint[]; dataChanged: boolean };
|
|
280
|
+
getDataPointByX(x: number): DataPoint | null;
|
|
281
|
+
getDataPointByXValue(xValue: any): DataPoint | null;
|
|
282
|
+
reset(): { xAxis: jmAxis; yAxis: jmAxis };
|
|
283
|
+
initAxisValue(): void;
|
|
284
|
+
createPoints(data?: any[]): DataPoint[];
|
|
285
|
+
getColor(p?: DataPoint): string;
|
|
286
|
+
createLegend(): jmControl;
|
|
287
|
+
createItemLabel(point: DataPoint, position?: string): void;
|
|
288
|
+
createPointItem(p: DataPoint): jmControl;
|
|
289
|
+
init?(): void;
|
|
290
|
+
addShape(shape: jmControl): jmControl;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* 柱图系列
|
|
295
|
+
*/
|
|
296
|
+
export declare class jmBarSeries extends jmSeries {
|
|
297
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
298
|
+
barIndex: number;
|
|
299
|
+
barWidth: number;
|
|
300
|
+
barTotalWidth: number;
|
|
301
|
+
init(): void;
|
|
302
|
+
initWidth(len: number): void;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* 堆叠柱图系列
|
|
307
|
+
*/
|
|
308
|
+
export declare class jmStackBarSeries extends jmBarSeries {
|
|
309
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* 线图系列
|
|
314
|
+
*/
|
|
315
|
+
export declare class jmLineSeries extends jmSeries {
|
|
316
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
317
|
+
init(): void;
|
|
318
|
+
createCurePoints(shapePoints: Point[], p: DataPoint): Point[];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* 堆叠线图系列
|
|
323
|
+
*/
|
|
324
|
+
export declare class jmStackLineSeries extends jmLineSeries {
|
|
325
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* 面积图系列
|
|
330
|
+
*/
|
|
331
|
+
export declare class jmAreaSeries extends jmLineSeries {
|
|
332
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
333
|
+
createLegend(): void;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* 饼图系列
|
|
338
|
+
*/
|
|
339
|
+
export declare class jmPieSeries extends jmSeries {
|
|
340
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
341
|
+
totalValue: number;
|
|
342
|
+
init(): void;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* 雷达图系列
|
|
347
|
+
*/
|
|
348
|
+
export declare class jmRadarSeries extends jmSeries {
|
|
349
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* 范围图系列
|
|
354
|
+
*/
|
|
355
|
+
export declare class jmRangeSeries extends jmSeries {
|
|
356
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* K线图系列
|
|
361
|
+
*/
|
|
362
|
+
export declare class jmCandlestickSeries extends jmSeries {
|
|
363
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* 散点图系列
|
|
368
|
+
*/
|
|
369
|
+
export declare class jmScatterSeries extends jmSeries {
|
|
370
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* 气泡图系列
|
|
375
|
+
*/
|
|
376
|
+
export declare class jmBubbleSeries extends jmSeries {
|
|
377
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* 热力图系列
|
|
382
|
+
*/
|
|
383
|
+
export declare class jmHeatmapSeries extends jmSeries {
|
|
384
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* 仪表盘系列
|
|
389
|
+
*/
|
|
390
|
+
export declare class jmGaugeSeries extends jmSeries {
|
|
391
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* 瀑布图系列
|
|
396
|
+
*/
|
|
397
|
+
export declare class jmWaterfallSeries extends jmSeries {
|
|
398
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* 漏斗图系列
|
|
403
|
+
*/
|
|
404
|
+
export declare class jmFunnelSeries extends jmSeries {
|
|
405
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* 环形进度图系列
|
|
410
|
+
*/
|
|
411
|
+
export declare class jmRingProgressSeries extends jmSeries {
|
|
412
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* 箱线图系列
|
|
417
|
+
*/
|
|
418
|
+
export declare class jmBoxPlotSeries extends jmSeries {
|
|
419
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* 词云图系列
|
|
424
|
+
*/
|
|
425
|
+
export declare class jmWordCloudSeries extends jmSeries {
|
|
426
|
+
constructor(options: SeriesOptions & { graph: jmChart });
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Vue 组件选项
|
|
431
|
+
*/
|
|
432
|
+
export interface VChartOptions {
|
|
433
|
+
chartData?: any[];
|
|
434
|
+
chartOptions?: jmChartOptions;
|
|
435
|
+
chartSeries?: Array<SeriesOptions & { type: SeriesType }>;
|
|
436
|
+
width?: string | number;
|
|
437
|
+
height?: string | number;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Vue 图表组件
|
|
442
|
+
*/
|
|
443
|
+
export declare const vChart: {
|
|
444
|
+
props: {
|
|
445
|
+
chartData: ArrayConstructor;
|
|
446
|
+
chartOptions: ObjectConstructor;
|
|
447
|
+
chartSeries: ArrayConstructor;
|
|
448
|
+
width: { type: StringConstructor; default: string };
|
|
449
|
+
height: { type: StringConstructor; default: string };
|
|
450
|
+
};
|
|
451
|
+
data: () => { option: jmChartOptions };
|
|
452
|
+
chartInstance: jmChart | null;
|
|
453
|
+
mounted: () => void;
|
|
454
|
+
updated: () => void;
|
|
455
|
+
destroyed: () => void;
|
|
456
|
+
watch: Record<string, { handler: (...args: any[]) => void; deep?: boolean }>;
|
|
457
|
+
methods: {
|
|
458
|
+
initChart(): void;
|
|
459
|
+
refresh(): void;
|
|
460
|
+
};
|
|
461
|
+
template: string;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* jmChart 图表主类
|
|
466
|
+
*/
|
|
467
|
+
export declare class jmChart extends jmGraph {
|
|
468
|
+
constructor(container: HTMLElement | string, options?: jmChartOptions);
|
|
469
|
+
|
|
470
|
+
data: any[];
|
|
471
|
+
series: jmList<jmSeries>;
|
|
472
|
+
enableAnimate: boolean;
|
|
473
|
+
baseY: number;
|
|
474
|
+
option: jmChartOptions & Record<string, any>;
|
|
475
|
+
xField: string;
|
|
476
|
+
chartArea: jmControl;
|
|
477
|
+
legend: jmLegend;
|
|
478
|
+
xAxis: jmAxis;
|
|
479
|
+
yAxises: Record<number, jmAxis>;
|
|
480
|
+
touchGraph?: jmGraph;
|
|
481
|
+
markLine: jmMarkLineManager;
|
|
482
|
+
style: jmChartStyle;
|
|
483
|
+
barSeriesCount: number;
|
|
484
|
+
serieTypes: Record<string, new (...args: any[]) => jmSeries>;
|
|
485
|
+
|
|
486
|
+
init(options: jmChartOptions): void;
|
|
487
|
+
reset(): void;
|
|
488
|
+
getColor(index: number): string;
|
|
489
|
+
beginDraw(): void;
|
|
490
|
+
resetAreaPosition(): void;
|
|
491
|
+
createAxis(options: AxisOptions): jmAxis;
|
|
492
|
+
createXAxis(options?: AxisOptions): jmAxis;
|
|
493
|
+
createYAxis(options?: AxisOptions): jmAxis;
|
|
494
|
+
createSeries(type: SeriesType | (new (...args: any[]) => jmSeries), options?: SeriesOptions): jmSeries;
|
|
495
|
+
destroy(): void;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export default jmChart;
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jmchart",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.17",
|
|
4
4
|
"description": "chart",
|
|
5
5
|
"main": "./index.js",
|
|
6
|
+
"types": "./index.d.ts",
|
|
6
7
|
"directories": {
|
|
7
8
|
"example": "example"
|
|
8
9
|
},
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
},
|
|
29
30
|
"homepage": "https://surl.fit/tools/tools/jmchart",
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"jmgraph": "^3.2.
|
|
32
|
+
"jmgraph": "^3.2.25"
|
|
32
33
|
},
|
|
33
34
|
"publishConfig": {
|
|
34
35
|
"registry": "https://registry.npmjs.org/"
|
package/src/common/style.js
CHANGED
|
@@ -556,25 +556,4 @@ export default {
|
|
|
556
556
|
zIndex: 11,
|
|
557
557
|
cursor: 'default'
|
|
558
558
|
},
|
|
559
|
-
sunburst: {
|
|
560
|
-
normal: {
|
|
561
|
-
zIndex: 11,
|
|
562
|
-
cursor: 'default'
|
|
563
|
-
},
|
|
564
|
-
hover: {
|
|
565
|
-
cursor: 'pointer'
|
|
566
|
-
},
|
|
567
|
-
innerRadius: 0,
|
|
568
|
-
startAngle: 0,
|
|
569
|
-
showLabels: true,
|
|
570
|
-
showCenter: true,
|
|
571
|
-
centerFill: '#fff',
|
|
572
|
-
centerStroke: '#e0e0e0',
|
|
573
|
-
stroke: '#fff',
|
|
574
|
-
lineWidth: 1,
|
|
575
|
-
labelColor: '#fff',
|
|
576
|
-
labelFont: '12px Arial',
|
|
577
|
-
zIndex: 11,
|
|
578
|
-
cursor: 'default'
|
|
579
|
-
}
|
|
580
559
|
}
|
package/src/jmChart.js
CHANGED
|
@@ -25,7 +25,6 @@ import jmFunnelSeries from './series/funnelSeries.js';
|
|
|
25
25
|
import jmRingProgressSeries from './series/ringProgressSeries.js';
|
|
26
26
|
import jmBoxPlotSeries from './series/boxPlotSeries.js';
|
|
27
27
|
import jmWordCloudSeries from './series/wordCloudSeries.js';
|
|
28
|
-
import jmSunburstSeries from './series/sunburstSeries.js';
|
|
29
28
|
import jmMarkLineManager from './core/markLine/manager';
|
|
30
29
|
|
|
31
30
|
const ANIMATION_DATA_THRESHOLD = 100;
|
|
@@ -443,8 +442,7 @@ export default class jmChart extends jmGraph {
|
|
|
443
442
|
'funnel': jmFunnelSeries,
|
|
444
443
|
'ringProgress': jmRingProgressSeries,
|
|
445
444
|
'boxPlot': jmBoxPlotSeries,
|
|
446
|
-
'wordCloud': jmWordCloudSeries
|
|
447
|
-
'sunburst': jmSunburstSeries
|
|
445
|
+
'wordCloud': jmWordCloudSeries
|
|
448
446
|
};
|
|
449
447
|
}
|
|
450
448
|
|
|
@@ -33,8 +33,10 @@ export default class jmGaugeSeries extends jmSeries {
|
|
|
33
33
|
|
|
34
34
|
const min = this.style.min || 0;
|
|
35
35
|
const max = this.style.max || 100;
|
|
36
|
-
|
|
37
|
-
const
|
|
36
|
+
// 度数转弧度(jmArc 内部使用弧度)
|
|
37
|
+
const DEG = Math.PI / 180;
|
|
38
|
+
const startAngle = (this.style.startAngle || -150) * DEG;
|
|
39
|
+
const endAngle = (this.style.endAngle || 150) * DEG;
|
|
38
40
|
|
|
39
41
|
const angleRange = endAngle - startAngle;
|
|
40
42
|
|
|
@@ -118,10 +120,10 @@ export default class jmGaugeSeries extends jmSeries {
|
|
|
118
120
|
const angle = startAngle + (angleStep * i);
|
|
119
121
|
const value = min + ((max - min) / (tickCount - 1)) * i;
|
|
120
122
|
|
|
121
|
-
const tickStartX = centerX + Math.cos(angle
|
|
122
|
-
const tickStartY = centerY + Math.sin(angle
|
|
123
|
-
const tickEndX = centerX + Math.cos(angle
|
|
124
|
-
const tickEndY = centerY + Math.sin(angle
|
|
123
|
+
const tickStartX = centerX + Math.cos(angle) * (radius - 30);
|
|
124
|
+
const tickStartY = centerY + Math.sin(angle) * (radius - 30);
|
|
125
|
+
const tickEndX = centerX + Math.cos(angle) * (radius - 10);
|
|
126
|
+
const tickEndY = centerY + Math.sin(angle) * (radius - 10);
|
|
125
127
|
|
|
126
128
|
const tickLine = this.graph.createShape('line', {
|
|
127
129
|
style: {
|
|
@@ -135,8 +137,8 @@ export default class jmGaugeSeries extends jmSeries {
|
|
|
135
137
|
|
|
136
138
|
this.addShape(tickLine);
|
|
137
139
|
|
|
138
|
-
const labelX = centerX + Math.cos(angle
|
|
139
|
-
const labelY = centerY + Math.sin(angle
|
|
140
|
+
const labelX = centerX + Math.cos(angle) * (radius - 45);
|
|
141
|
+
const labelY = centerY + Math.sin(angle) * (radius - 45);
|
|
140
142
|
|
|
141
143
|
const tickLabel = this.graph.createShape('label', {
|
|
142
144
|
style: {
|
|
@@ -159,8 +161,8 @@ export default class jmGaugeSeries extends jmSeries {
|
|
|
159
161
|
*/
|
|
160
162
|
createGaugePointer(centerX, centerY, radius, angle) {
|
|
161
163
|
const pointerLength = radius * 0.7;
|
|
162
|
-
const pointerX = centerX + Math.cos(angle
|
|
163
|
-
const pointerY = centerY + Math.sin(angle
|
|
164
|
+
const pointerX = centerX + Math.cos(angle) * pointerLength;
|
|
165
|
+
const pointerY = centerY + Math.sin(angle) * pointerLength;
|
|
164
166
|
|
|
165
167
|
const pointerLine = this.graph.createShape('line', {
|
|
166
168
|
style: {
|