@visactor/taro-vchart 1.12.0-alpha.6 → 1.12.0-alpha.7
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/lib/src/charts/AreaChart.d.ts +2 -0
- package/lib/src/charts/Bar3dChart.d.ts +2 -0
- package/lib/src/charts/BarChart.d.ts +2 -0
- package/lib/src/charts/BoxPlotChart.d.ts +2 -0
- package/lib/src/charts/CirclePackingChart.d.ts +2 -0
- package/lib/src/charts/CircularProgressChart.d.ts +2 -0
- package/lib/src/charts/CommonChart.d.ts +2 -0
- package/lib/src/charts/CorrelationChart.d.ts +2 -0
- package/lib/src/charts/Funnel3dChart.d.ts +2 -0
- package/lib/src/charts/FunnelChart.d.ts +2 -0
- package/lib/src/charts/GaugeChart.d.ts +2 -0
- package/lib/src/charts/HeatmapChart.d.ts +2 -0
- package/lib/src/charts/Histogram3dChart.d.ts +2 -0
- package/lib/src/charts/HistogramChart.d.ts +2 -0
- package/lib/src/charts/LineChart.d.ts +2 -0
- package/lib/src/charts/LinearProgressChart.d.ts +2 -0
- package/lib/src/charts/LiquidChart.d.ts +2 -0
- package/lib/src/charts/MapChart.d.ts +2 -0
- package/lib/src/charts/Pie3dChart.d.ts +2 -0
- package/lib/src/charts/PieChart.d.ts +2 -0
- package/lib/src/charts/RadarChart.d.ts +2 -0
- package/lib/src/charts/RangeColumn3dChart.d.ts +2 -0
- package/lib/src/charts/RangeColumnChart.d.ts +2 -0
- package/lib/src/charts/RoseChart.d.ts +2 -0
- package/lib/src/charts/SankeyChart.d.ts +2 -0
- package/lib/src/charts/ScatterChart.d.ts +2 -0
- package/lib/src/charts/SequenceChart.d.ts +2 -0
- package/lib/src/charts/SunburstChart.d.ts +2 -0
- package/lib/src/charts/TreemapChart.d.ts +2 -0
- package/lib/src/charts/VennChart.d.ts +2 -0
- package/lib/src/charts/WaterfallChart.d.ts +2 -0
- package/lib/src/charts/WordCloud3dChart.d.ts +2 -0
- package/lib/src/charts/WordCloudChart.d.ts +2 -0
- package/lib/src/charts/generate-charts.d.ts +4 -0
- package/lib/src/charts/index.d.ts +34 -0
- package/lib/src/charts/register.d.ts +3 -0
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.js +221 -1
- package/lib/src/typings/IChartProps.d.ts +3 -3
- package/lib/src/vchart.d.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IVChartProps } from '../typings/IChartProps';
|
|
3
|
+
import { ISpec } from '../typings/IVChart';
|
|
4
|
+
export declare const createChart: <T extends ISpec>(componentName: string, defaultProps?: Partial<IVChartProps<T>> | undefined, registers?: (() => void)[]) => React.ForwardRefExoticComponent<IVChartProps<ISpec> & React.RefAttributes<any>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export * from './AreaChart';
|
|
2
|
+
export * from './BarChart';
|
|
3
|
+
export * from './Bar3dChart';
|
|
4
|
+
export * from './BoxPlotChart';
|
|
5
|
+
export * from './CirclePackingChart';
|
|
6
|
+
export * from './CircularProgressChart';
|
|
7
|
+
export * from './CommonChart';
|
|
8
|
+
export * from './CorrelationChart';
|
|
9
|
+
export * from './FunnelChart';
|
|
10
|
+
export * from './Funnel3dChart';
|
|
11
|
+
export * from './GaugeChart';
|
|
12
|
+
export * from './HeatmapChart';
|
|
13
|
+
export * from './Histogram3dChart';
|
|
14
|
+
export * from './HistogramChart';
|
|
15
|
+
export * from './LinearProgressChart';
|
|
16
|
+
export * from './LineChart';
|
|
17
|
+
export * from './LiquidChart';
|
|
18
|
+
export * from './MapChart';
|
|
19
|
+
export * from './PieChart';
|
|
20
|
+
export * from './Pie3dChart';
|
|
21
|
+
export * from './RadarChart';
|
|
22
|
+
export * from './RangeColumnChart';
|
|
23
|
+
export * from './RangeColumn3dChart';
|
|
24
|
+
export * from './RoseChart';
|
|
25
|
+
export * from './SankeyChart';
|
|
26
|
+
export * from './ScatterChart';
|
|
27
|
+
export * from './SequenceChart';
|
|
28
|
+
export * from './SunburstChart';
|
|
29
|
+
export * from './TreemapChart';
|
|
30
|
+
export * from './WordCloudChart';
|
|
31
|
+
export * from './WordCloud3dChart';
|
|
32
|
+
export * from './WordCloudChart';
|
|
33
|
+
export * from './VennChart';
|
|
34
|
+
export { VChart as VChartCore } from '@visactor/vchart';
|
package/lib/src/index.d.ts
CHANGED
package/lib/src/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { View, Canvas } from '@tarojs/components';
|
|
3
3
|
import Taro from '@tarojs/taro';
|
|
4
4
|
import { VChart as VChart$1, registerLarkEnv, registerTTEnv, registerWXEnv } from '@visactor/vchart/build/es5';
|
|
5
|
+
import { registerCartesianLinearAxis, registerCartesianBandAxis, registerCartesianTimeAxis, registerCartesianLogAxis, registerCartesianCrossHair, registerBrush, registerContinuousLegend, registerDataZoom, registerDiscreteLegend, registerCustomMark, registerAllMarks, registerMarkArea, registerMarkLine, registerMarkPoint, registerScrollBar, registerTitle, registerPolarLinearAxis, registerPolarBandAxis, registerPolarCrossHair, registerLarkEnv as registerLarkEnv$1, registerTTEnv as registerTTEnv$1, registerWXEnv as registerWXEnv$1, registerAreaChart, registerLabel, VChart as VChart$2, registerBarChart, registerTotalLabel, registerBar3dChart, registerBoxplotChart, registerCirclePackingChart, registerCircularProgressChart, registerIndicator, registerCommonChart, registerAreaSeries, registerBarSeries, registerLineSeries, registerScatterSeries, registerPieSeries, registerCorrelationChart, registerFunnelChart, registerFunnel3dChart, registerGaugeChart, registerHeatmapChart, registerHistogram3dChart, registerHistogramChart, registerLinearProgressChart, registerLineChart, registerLiquidChart, registerMapChart, registerPieChart, registerPie3dChart, registerRadarChart, registerRangeColumnChart, registerRangeColumn3dChart, registerRoseChart, registerSankeyChart, registerScatterChart, registerSequenceChart, registerSunburstChart, registerTreemapChart, registerWordCloudChart, registerWordCloud3dChart, registerVennChart } from '@visactor/vchart';
|
|
6
|
+
export { VChart as VChartCore } from '@visactor/vchart';
|
|
5
7
|
|
|
6
8
|
/*! *****************************************************************************
|
|
7
9
|
Copyright (c) Microsoft Corporation.
|
|
@@ -372,4 +374,222 @@ function VChart(_a) {
|
|
|
372
374
|
return React.createElement(GeneralChart, Object.assign({}, props));
|
|
373
375
|
}
|
|
374
376
|
|
|
375
|
-
|
|
377
|
+
const cartesianComponentsRegisters = [
|
|
378
|
+
registerCartesianLinearAxis,
|
|
379
|
+
registerCartesianBandAxis,
|
|
380
|
+
registerCartesianTimeAxis,
|
|
381
|
+
registerCartesianLogAxis,
|
|
382
|
+
registerCartesianCrossHair,
|
|
383
|
+
registerBrush,
|
|
384
|
+
registerContinuousLegend,
|
|
385
|
+
registerDataZoom,
|
|
386
|
+
registerDiscreteLegend,
|
|
387
|
+
registerCustomMark,
|
|
388
|
+
registerAllMarks,
|
|
389
|
+
registerMarkArea,
|
|
390
|
+
registerMarkLine,
|
|
391
|
+
registerMarkPoint,
|
|
392
|
+
registerScrollBar,
|
|
393
|
+
registerTitle
|
|
394
|
+
];
|
|
395
|
+
const polarComponentsRegisters = [
|
|
396
|
+
registerPolarLinearAxis,
|
|
397
|
+
registerPolarBandAxis,
|
|
398
|
+
registerPolarCrossHair,
|
|
399
|
+
registerBrush,
|
|
400
|
+
registerContinuousLegend,
|
|
401
|
+
registerDataZoom,
|
|
402
|
+
registerDiscreteLegend,
|
|
403
|
+
registerCustomMark,
|
|
404
|
+
registerAllMarks,
|
|
405
|
+
registerScrollBar,
|
|
406
|
+
registerTitle
|
|
407
|
+
];
|
|
408
|
+
const simpleComponentsRegisters = [
|
|
409
|
+
registerDiscreteLegend,
|
|
410
|
+
registerContinuousLegend,
|
|
411
|
+
registerCustomMark,
|
|
412
|
+
registerAllMarks,
|
|
413
|
+
registerTitle
|
|
414
|
+
];
|
|
415
|
+
|
|
416
|
+
const createChart = (componentName, defaultProps, registers) => {
|
|
417
|
+
if (registers && registers.length && defaultProps && defaultProps.chartConstructor) {
|
|
418
|
+
defaultProps.chartConstructor.useRegisters(registers);
|
|
419
|
+
}
|
|
420
|
+
const Cls = React.forwardRef((props, ref) => {
|
|
421
|
+
const { type } = props, args = __rest(props, ["type"]);
|
|
422
|
+
const env = (type !== null && type !== void 0 ? type : Taro.getEnv()).toLocaleLowerCase();
|
|
423
|
+
const strategies = {
|
|
424
|
+
lark: () => {
|
|
425
|
+
registerLarkEnv$1();
|
|
426
|
+
return React.createElement(GeneralChart, Object.assign({}, defaultProps, args, { mode: "miniApp" }));
|
|
427
|
+
},
|
|
428
|
+
tt: () => {
|
|
429
|
+
registerTTEnv$1();
|
|
430
|
+
return React.createElement(GeneralChart, Object.assign({}, defaultProps, args, { mode: "tt" }));
|
|
431
|
+
},
|
|
432
|
+
weapp: () => {
|
|
433
|
+
registerWXEnv$1();
|
|
434
|
+
return React.createElement(GeneralChart, Object.assign({}, defaultProps, args, { mode: "wx" }));
|
|
435
|
+
},
|
|
436
|
+
web: () => {
|
|
437
|
+
return React.createElement(WebChart, Object.assign({}, defaultProps, args));
|
|
438
|
+
},
|
|
439
|
+
h5: () => {
|
|
440
|
+
return React.createElement(WebChart, Object.assign({}, defaultProps, args, { mode: "mobile-browser" }));
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
if (env && strategies[env] !== undefined) {
|
|
444
|
+
return strategies[env].call();
|
|
445
|
+
}
|
|
446
|
+
console.warn(`暂不支持 ${env} 环境`);
|
|
447
|
+
return React.createElement(GeneralChart, Object.assign({}, args));
|
|
448
|
+
});
|
|
449
|
+
Cls.displayName = componentName;
|
|
450
|
+
return Cls;
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
const AreaChart = createChart('AreaChart', {
|
|
454
|
+
chartConstructor: VChart$2
|
|
455
|
+
}, [registerAreaChart, registerLabel, ...cartesianComponentsRegisters]);
|
|
456
|
+
|
|
457
|
+
const BarChart = createChart('BarChart', {
|
|
458
|
+
chartConstructor: VChart$2
|
|
459
|
+
}, [registerBarChart, registerLabel, registerTotalLabel, ...cartesianComponentsRegisters]);
|
|
460
|
+
|
|
461
|
+
const Bar3dChart = createChart('Bar3dChart', {
|
|
462
|
+
chartConstructor: VChart$2
|
|
463
|
+
}, [registerBar3dChart, registerLabel, registerTotalLabel, ...cartesianComponentsRegisters]);
|
|
464
|
+
|
|
465
|
+
const BoxPlotChart = createChart('BoxPlotChart', {
|
|
466
|
+
chartConstructor: VChart$2
|
|
467
|
+
}, [registerBoxplotChart, registerLabel, ...cartesianComponentsRegisters]);
|
|
468
|
+
|
|
469
|
+
const CirclePackingChart = createChart('CirclePackingChart', {
|
|
470
|
+
chartConstructor: VChart$2
|
|
471
|
+
}, [registerCirclePackingChart, ...cartesianComponentsRegisters]);
|
|
472
|
+
|
|
473
|
+
const CircularProgressChart = createChart('CircularProgressChart', {
|
|
474
|
+
chartConstructor: VChart$2
|
|
475
|
+
}, [registerCircularProgressChart, registerLabel, registerIndicator, ...cartesianComponentsRegisters]);
|
|
476
|
+
|
|
477
|
+
const CommonChart = createChart('CommonChart', {
|
|
478
|
+
chartConstructor: VChart$2
|
|
479
|
+
}, [
|
|
480
|
+
registerCommonChart,
|
|
481
|
+
registerCartesianLinearAxis,
|
|
482
|
+
registerCartesianBandAxis,
|
|
483
|
+
registerCartesianTimeAxis,
|
|
484
|
+
registerCartesianLogAxis,
|
|
485
|
+
registerCartesianCrossHair,
|
|
486
|
+
registerLabel,
|
|
487
|
+
registerTotalLabel,
|
|
488
|
+
registerAreaSeries,
|
|
489
|
+
registerBarSeries,
|
|
490
|
+
registerLineSeries,
|
|
491
|
+
registerScatterSeries,
|
|
492
|
+
registerPieSeries
|
|
493
|
+
]);
|
|
494
|
+
|
|
495
|
+
const CorrelationChart = createChart('CorrelationChart', {
|
|
496
|
+
chartConstructor: VChart$2
|
|
497
|
+
}, [registerCorrelationChart, ...cartesianComponentsRegisters]);
|
|
498
|
+
|
|
499
|
+
const FunnelChart = createChart('FunnelChart', {
|
|
500
|
+
chartConstructor: VChart$2
|
|
501
|
+
}, [registerFunnelChart, registerLabel, ...simpleComponentsRegisters]);
|
|
502
|
+
|
|
503
|
+
const Funnel3dChart = createChart('Funnel3dChart', {
|
|
504
|
+
chartConstructor: VChart$2
|
|
505
|
+
}, [registerFunnel3dChart, registerLabel, ...simpleComponentsRegisters]);
|
|
506
|
+
|
|
507
|
+
const GaugeChart = createChart('GaugeChart', {
|
|
508
|
+
chartConstructor: VChart$2
|
|
509
|
+
}, [registerGaugeChart, ...simpleComponentsRegisters]);
|
|
510
|
+
|
|
511
|
+
const HeatmapChart = createChart('HeatmapChart', {
|
|
512
|
+
chartConstructor: VChart$2
|
|
513
|
+
}, [registerHeatmapChart, registerLabel, ...cartesianComponentsRegisters]);
|
|
514
|
+
|
|
515
|
+
const Histogram3dChart = createChart('Histogram3dChart', {
|
|
516
|
+
chartConstructor: VChart$2
|
|
517
|
+
}, [registerHistogram3dChart, registerLabel, ...cartesianComponentsRegisters]);
|
|
518
|
+
|
|
519
|
+
const HistogramChart = createChart('HistogramChart', {
|
|
520
|
+
chartConstructor: VChart$2
|
|
521
|
+
}, [registerHistogramChart, registerLabel, ...cartesianComponentsRegisters]);
|
|
522
|
+
|
|
523
|
+
const LinearProgressChart = createChart('LinearProgressChart', {
|
|
524
|
+
chartConstructor: VChart$2
|
|
525
|
+
}, [registerLinearProgressChart, registerLabel, ...cartesianComponentsRegisters]);
|
|
526
|
+
|
|
527
|
+
const LineChart = createChart('LineChart', {
|
|
528
|
+
chartConstructor: VChart$2
|
|
529
|
+
}, [registerLineChart, registerLabel, registerTotalLabel, ...cartesianComponentsRegisters]);
|
|
530
|
+
|
|
531
|
+
const LiquidChart = createChart('LiquidChart', {
|
|
532
|
+
chartConstructor: VChart$2
|
|
533
|
+
}, [registerLiquidChart, registerIndicator, ...simpleComponentsRegisters]);
|
|
534
|
+
|
|
535
|
+
const MapChart = createChart('MapChart', {
|
|
536
|
+
chartConstructor: VChart$2
|
|
537
|
+
}, [registerMapChart, registerLabel, ...simpleComponentsRegisters]);
|
|
538
|
+
|
|
539
|
+
const PieChart = createChart('PieChart', {
|
|
540
|
+
chartConstructor: VChart$2
|
|
541
|
+
}, [registerPieChart, registerLabel, registerIndicator, ...simpleComponentsRegisters]);
|
|
542
|
+
|
|
543
|
+
const Pie3dChart = createChart('Pie3dChart', {
|
|
544
|
+
chartConstructor: VChart$2
|
|
545
|
+
}, [registerPie3dChart, registerLabel, registerIndicator, ...simpleComponentsRegisters]);
|
|
546
|
+
|
|
547
|
+
const RadarChart = createChart('RadarChart', {
|
|
548
|
+
chartConstructor: VChart$2
|
|
549
|
+
}, [registerRadarChart, registerLabel, ...polarComponentsRegisters]);
|
|
550
|
+
|
|
551
|
+
const RangeColumnChart = createChart('RangeColumnChart', {
|
|
552
|
+
chartConstructor: VChart$2
|
|
553
|
+
}, [registerRangeColumnChart, registerLabel, ...cartesianComponentsRegisters]);
|
|
554
|
+
|
|
555
|
+
const RangeColumn3dChart = createChart('RangeColumn3dChart', {
|
|
556
|
+
chartConstructor: VChart$2
|
|
557
|
+
}, [registerRangeColumn3dChart, registerLabel, ...cartesianComponentsRegisters]);
|
|
558
|
+
|
|
559
|
+
const RoseChart = createChart('RoseChart', {
|
|
560
|
+
chartConstructor: VChart$2
|
|
561
|
+
}, [registerRoseChart, registerLabel, ...polarComponentsRegisters]);
|
|
562
|
+
|
|
563
|
+
const SankeyChart = createChart('SankeyChart', {
|
|
564
|
+
chartConstructor: VChart$2
|
|
565
|
+
}, [registerSankeyChart, ...simpleComponentsRegisters]);
|
|
566
|
+
|
|
567
|
+
const ScatterChart = createChart('ScatterChart', {
|
|
568
|
+
chartConstructor: VChart$2
|
|
569
|
+
}, [registerScatterChart, registerLabel, ...cartesianComponentsRegisters]);
|
|
570
|
+
|
|
571
|
+
const SequenceChart = createChart('SequenceChart', {
|
|
572
|
+
chartConstructor: VChart$2
|
|
573
|
+
}, [registerSequenceChart, ...cartesianComponentsRegisters]);
|
|
574
|
+
|
|
575
|
+
const SunburstChart = createChart('SunburstChart', {
|
|
576
|
+
chartConstructor: VChart$2
|
|
577
|
+
}, [registerSunburstChart, ...simpleComponentsRegisters]);
|
|
578
|
+
|
|
579
|
+
const TreemapChart = createChart('TreemapChart', {
|
|
580
|
+
chartConstructor: VChart$2
|
|
581
|
+
}, [registerTreemapChart, ...simpleComponentsRegisters]);
|
|
582
|
+
|
|
583
|
+
const WordCloudChart = createChart('WordCloudChart', {
|
|
584
|
+
chartConstructor: VChart$2
|
|
585
|
+
}, [registerWordCloudChart, ...simpleComponentsRegisters]);
|
|
586
|
+
|
|
587
|
+
const WordCloud3dChart = createChart('WordCloud3dChart', {
|
|
588
|
+
chartConstructor: VChart$2
|
|
589
|
+
}, [registerWordCloud3dChart, ...simpleComponentsRegisters]);
|
|
590
|
+
|
|
591
|
+
const VennChart = createChart('VennChart', {
|
|
592
|
+
chartConstructor: VChart$2
|
|
593
|
+
}, [registerVennChart, ...simpleComponentsRegisters]);
|
|
594
|
+
|
|
595
|
+
export { AreaChart, Bar3dChart, BarChart, BoxPlotChart, CirclePackingChart, CircularProgressChart, CommonChart, CorrelationChart, Funnel3dChart, FunnelChart, GaugeChart, HeatmapChart, Histogram3dChart, HistogramChart, LineChart, LinearProgressChart, LiquidChart, MapChart, Pie3dChart, PieChart, RadarChart, RangeColumn3dChart, RangeColumnChart, RoseChart, SankeyChart, ScatterChart, SequenceChart, SunburstChart, TreemapChart, VChart, VChartSimple, VennChart, WordCloud3dChart, WordCloudChart };
|
|
@@ -3,7 +3,7 @@ import { IOptions } from './IOptions';
|
|
|
3
3
|
import { IVChart, ISpec, IVChartConstructor } from './IVChart';
|
|
4
4
|
import { IEvent } from './IEvent';
|
|
5
5
|
import { VChartEnvType } from './VChartEnvType';
|
|
6
|
-
interface IChartProps {
|
|
6
|
+
interface IChartProps<SpecType = ISpec> {
|
|
7
7
|
/**
|
|
8
8
|
* 图表构造函数,必须
|
|
9
9
|
*/
|
|
@@ -15,7 +15,7 @@ interface IChartProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* VChart 图表配置项
|
|
17
17
|
*/
|
|
18
|
-
spec:
|
|
18
|
+
spec: SpecType;
|
|
19
19
|
/**
|
|
20
20
|
* 图表容器样式
|
|
21
21
|
*/
|
|
@@ -47,7 +47,7 @@ interface IChartProps {
|
|
|
47
47
|
*/
|
|
48
48
|
onChartUpdate?: (chart: IVChart) => void;
|
|
49
49
|
}
|
|
50
|
-
interface IVChartProps extends IChartProps {
|
|
50
|
+
interface IVChartProps<SpecType = ISpec> extends IChartProps<SpecType> {
|
|
51
51
|
/**
|
|
52
52
|
* 配置环境。如果没有声明,则会通过 `Taro.getEnv()` 自动获取。
|
|
53
53
|
* - `tt` 字节小程序。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/taro-vchart",
|
|
3
|
-
"version": "1.12.0-alpha.
|
|
3
|
+
"version": "1.12.0-alpha.7",
|
|
4
4
|
"description": "Taro VChart 图表组件",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "lib/src/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@visactor/vchart": "1.12.0-alpha.
|
|
34
|
+
"@visactor/vchart": "1.12.0-alpha.7"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@rushstack/eslint-patch": "~1.1.4",
|