@univerjs-pro/sheets-chart-ui 0.6.3 → 0.6.4
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/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/locale/en-US.js +1 -1
- package/lib/es/locale/fa-IR.js +1 -1
- package/lib/es/locale/fr-FR.js +1 -1
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/vi-VN.js +1 -1
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/types/facade/chart-builder/chart-builder-base.d.ts +247 -121
- package/lib/types/facade/chart-builder/line-chart-builder.d.ts +92 -8
- package/lib/types/facade/chart-builder/pie-chart-builder.d.ts +120 -10
- package/lib/types/facade/chart-builder/radar-chart-builder.d.ts +39 -23
- package/lib/types/facade/f-chart.d.ts +31 -12
- package/lib/types/facade/f-enum.d.ts +123 -55
- package/lib/types/facade/f-worksheet.d.ts +101 -35
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +14 -14
|
@@ -295,19 +295,6 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
295
295
|
* @description The chart type of the chart this builder modifies. The chart type (ChartTypeBits) can be found from package @univerjs-pro/sheets-chart.
|
|
296
296
|
* Please pay attention to the type of the chart you are creating, a Pie chart have a property of Doughnut is donut chart, and a Pie chart have a property of Rose is rose pie chart.But the chart builder will not change the chart type to the corresponding chart type.
|
|
297
297
|
* @returns {ChartTypeBits} ChartType - The chart type of the chart this builder modifies.
|
|
298
|
-
*
|
|
299
|
-
* @example
|
|
300
|
-
* ```ts
|
|
301
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
302
|
-
* const fSheet = fWorkbook.getActiveSheet();
|
|
303
|
-
* const charts = fSheet.getCharts();
|
|
304
|
-
* if(charts.length > 0) {
|
|
305
|
-
* const chart = charts[0];
|
|
306
|
-
* const chartBuilder = chart.getChartBuilder();
|
|
307
|
-
* const chartType = chartBuilder.getChartType();
|
|
308
|
-
* console.log(chartType); // The chart type of first chart.
|
|
309
|
-
* }
|
|
310
|
-
* ```
|
|
311
298
|
*/
|
|
312
299
|
getChartType(): ChartTypeBits;
|
|
313
300
|
/**
|
|
@@ -318,15 +305,16 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
318
305
|
* @example
|
|
319
306
|
* ```ts
|
|
320
307
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
321
|
-
* const
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
308
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
309
|
+
*
|
|
310
|
+
* // Create a column chart with data source A1:D6
|
|
311
|
+
* // The starting position is upper-left corner of cell B2.
|
|
312
|
+
* const chartInfo = fWorksheet.newChart()
|
|
326
313
|
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
314
|
+
* .addRange('A1:D6')
|
|
327
315
|
* .setPosition(1, 1, 0, 0)
|
|
328
316
|
* .build();
|
|
329
|
-
*
|
|
317
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
330
318
|
* ```
|
|
331
319
|
*/
|
|
332
320
|
addRange(range: IRange | string): this;
|
|
@@ -347,14 +335,16 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
347
335
|
* @example
|
|
348
336
|
* ```ts
|
|
349
337
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
350
|
-
* const
|
|
351
|
-
*
|
|
352
|
-
*
|
|
338
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
339
|
+
*
|
|
340
|
+
* // Create a column chart with data source A1:D6
|
|
341
|
+
* // The starting position is upper-left corner of cell F3 and offset 20 pixels to the right and down.
|
|
342
|
+
* const chartInfo = fWorksheet.newChart()
|
|
353
343
|
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
354
|
-
*
|
|
344
|
+
* .addRange('A1:D6')
|
|
355
345
|
* .setPosition(2, 5, 20, 20)
|
|
356
346
|
* .build();
|
|
357
|
-
*
|
|
347
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
358
348
|
* ```
|
|
359
349
|
*/
|
|
360
350
|
setPosition(anchorRowPos: number, anchorColPos: number, rowOffset: number, columnOffset: number): this;
|
|
@@ -368,14 +358,16 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
368
358
|
* @example
|
|
369
359
|
* ```ts
|
|
370
360
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
371
|
-
* const
|
|
372
|
-
*
|
|
373
|
-
*
|
|
361
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
362
|
+
*
|
|
363
|
+
* // Create a column chart with data source A1:D6
|
|
364
|
+
* // The starting position is (100, 200) pixels from the top left-hand corner of the sheet.
|
|
365
|
+
* const chartInfo = fWorksheet.newChart()
|
|
374
366
|
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
375
|
-
*
|
|
367
|
+
* .addRange('A1:D6')
|
|
376
368
|
* .setAbsolutePosition(100, 200)
|
|
377
369
|
* .build();
|
|
378
|
-
*
|
|
370
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
379
371
|
* ```
|
|
380
372
|
*/
|
|
381
373
|
setAbsolutePosition(x: number, y: number): this;
|
|
@@ -388,17 +380,27 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
388
380
|
* @example
|
|
389
381
|
* ```ts
|
|
390
382
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
391
|
-
* const
|
|
392
|
-
*
|
|
393
|
-
*
|
|
383
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
384
|
+
*
|
|
385
|
+
* // Create a column chart with data source A1:D6
|
|
386
|
+
* // The starting position is upper-left corner of cell B2.
|
|
387
|
+
* const chartInfo = fWorksheet.newChart()
|
|
394
388
|
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
389
|
+
* .addRange('A1:D6')
|
|
395
390
|
* .setPosition(1, 1, 0, 0)
|
|
396
391
|
* .build();
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
* const
|
|
401
|
-
*
|
|
392
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
393
|
+
*
|
|
394
|
+
* // Get all charts on the active sheet.
|
|
395
|
+
* const charts = fWorksheet.getCharts();
|
|
396
|
+
*
|
|
397
|
+
* // Update the first chart type to line after 3 seconds.
|
|
398
|
+
* setTimeout(() => {
|
|
399
|
+
* const newChartInfo = fWorksheet.newChart(charts[0])
|
|
400
|
+
* .setChartType(univerAPI.Enum.ChartType.Line)
|
|
401
|
+
* .build();
|
|
402
|
+
* fWorksheet.updateChart(newChartInfo);
|
|
403
|
+
* }, 3000);
|
|
402
404
|
* ```
|
|
403
405
|
*/
|
|
404
406
|
setChartType(chartType: ChartTypeBits): this;
|
|
@@ -406,12 +408,48 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
406
408
|
* Sets the width of the chart in pixels.
|
|
407
409
|
* @param {number} width The width of the chart in pixels.
|
|
408
410
|
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```ts
|
|
414
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
415
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
416
|
+
*
|
|
417
|
+
* // Create a column chart with data source A1:D6
|
|
418
|
+
* // The starting position is upper-left corner of cell B2.
|
|
419
|
+
* // The width of the chart is 600 and the height is 400.
|
|
420
|
+
* const chartInfo = fWorksheet.newChart()
|
|
421
|
+
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
422
|
+
* .addRange('A1:D6')
|
|
423
|
+
* .setPosition(1, 1, 0, 0)
|
|
424
|
+
* .setWidth(600)
|
|
425
|
+
* .setHeight(400)
|
|
426
|
+
* .build();
|
|
427
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
428
|
+
* ```
|
|
409
429
|
*/
|
|
410
430
|
setWidth(width: number): this;
|
|
411
431
|
/**
|
|
412
432
|
* Sets the height of the chart in pixels.
|
|
413
433
|
* @param {number} height The height of the chart in pixels.
|
|
414
434
|
* @returns {FChartBuilderBase} -this builder, for chaining.
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```ts
|
|
438
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
439
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
440
|
+
*
|
|
441
|
+
* // Create a column chart with data source A1:D6
|
|
442
|
+
* // The starting position is upper-left corner of cell B2.
|
|
443
|
+
* // The width of the chart is 600 and the height is 400.
|
|
444
|
+
* const chartInfo = fWorksheet.newChart()
|
|
445
|
+
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
446
|
+
* .addRange('A1:D6')
|
|
447
|
+
* .setPosition(1, 1, 0, 0)
|
|
448
|
+
* .setWidth(600)
|
|
449
|
+
* .setHeight(400)
|
|
450
|
+
* .build();
|
|
451
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
452
|
+
* ```
|
|
415
453
|
*/
|
|
416
454
|
setHeight(height: number): this;
|
|
417
455
|
/**
|
|
@@ -425,7 +463,6 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
425
463
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
426
464
|
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
427
465
|
* const chartBuilder = fWorkSheet.newChart().asPieChart();
|
|
428
|
-
*
|
|
429
466
|
* const chartBuilderInfo1 = chartBuilder
|
|
430
467
|
* .addRange('A1:D6')
|
|
431
468
|
* .setOptions('title.content', 'Chart Title')
|
|
@@ -453,9 +490,9 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
453
490
|
* }
|
|
454
491
|
* })
|
|
455
492
|
* .build();
|
|
456
|
-
* fWorkSheet.insertChart(chartBuilderInfo1);
|
|
493
|
+
* await fWorkSheet.insertChart(chartBuilderInfo1);
|
|
457
494
|
* // or they are same effect
|
|
458
|
-
* // fWorkSheet.insertChart(chartBuilderInfo2);
|
|
495
|
+
* // await fWorkSheet.insertChart(chartBuilderInfo2);
|
|
459
496
|
* ```
|
|
460
497
|
*/
|
|
461
498
|
setOptions(optionPath: string, optionVal: unknown): this;
|
|
@@ -467,15 +504,19 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
467
504
|
* @example
|
|
468
505
|
* ```ts
|
|
469
506
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
470
|
-
* const
|
|
471
|
-
*
|
|
472
|
-
*
|
|
507
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
508
|
+
*
|
|
509
|
+
* // Create a column chart with data source A1:D6
|
|
510
|
+
* // The starting position is upper-left corner of cell B2.
|
|
511
|
+
* // The chart will transpose the rows and columns.
|
|
512
|
+
* const chartInfo = fWorksheet.newChart()
|
|
473
513
|
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
514
|
+
* .addRange('A1:D6')
|
|
474
515
|
* .setPosition(1, 1, 0, 0)
|
|
475
516
|
* // the chart will transpose the rows and columns
|
|
476
517
|
* .setTransposeRowsAndColumns(true)
|
|
477
518
|
* .build();
|
|
478
|
-
*
|
|
519
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
479
520
|
* ```
|
|
480
521
|
*/
|
|
481
522
|
setTransposeRowsAndColumns(transposeRowsAndColumns: boolean): this;
|
|
@@ -487,14 +528,48 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
487
528
|
* @example
|
|
488
529
|
* ```ts
|
|
489
530
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
490
|
-
* const
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
*
|
|
531
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
532
|
+
*
|
|
533
|
+
* // register your theme
|
|
534
|
+
* const theme = { // your theme object
|
|
535
|
+
* 'version': 1,
|
|
536
|
+
* 'themeName': 'myTheme',
|
|
537
|
+
* 'theme': {
|
|
538
|
+
* // ... Some code is omitted for brevity
|
|
539
|
+
* color: [
|
|
540
|
+
* '#893448',
|
|
541
|
+
* '#d95850',
|
|
542
|
+
* '#eb8146',
|
|
543
|
+
* '#ffb248',
|
|
544
|
+
* '#f2d643',
|
|
545
|
+
* '#ebdba4'
|
|
546
|
+
* ],
|
|
547
|
+
* // ... Some code is omitted for brevity
|
|
548
|
+
* visualMapColor: [
|
|
549
|
+
* '#893448',
|
|
550
|
+
* '#d95850',
|
|
551
|
+
* '#eb8146',
|
|
552
|
+
* '#ffb248',
|
|
553
|
+
* '#f2d643',
|
|
554
|
+
* 'rgb(247,238,173)'
|
|
555
|
+
* ],
|
|
556
|
+
* // ... Some code is omitted for brevity
|
|
557
|
+
* 'axes': [
|
|
558
|
+
* // ... Some code is omitted for brevity
|
|
559
|
+
* ]
|
|
560
|
+
* // ... Some code is omitted for brevity
|
|
561
|
+
* }
|
|
562
|
+
* };
|
|
563
|
+
* fWorksheet.registerChartTheme('myTheme', theme);
|
|
564
|
+
*
|
|
565
|
+
* // use your theme for chart
|
|
566
|
+
* const chartInfo = fWorksheet.newChart()
|
|
567
|
+
* .asLineChart()
|
|
568
|
+
* .addRange('A1:D6')
|
|
494
569
|
* .setPosition(1, 1, 0, 0)
|
|
495
|
-
* .setTheme('
|
|
570
|
+
* .setTheme('myTheme')
|
|
496
571
|
* .build();
|
|
497
|
-
*
|
|
572
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
498
573
|
* ```
|
|
499
574
|
*/
|
|
500
575
|
setTheme(theme: string): this;
|
|
@@ -506,14 +581,18 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
506
581
|
* @example
|
|
507
582
|
* ```ts
|
|
508
583
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
509
|
-
* const
|
|
510
|
-
*
|
|
511
|
-
*
|
|
584
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
585
|
+
*
|
|
586
|
+
* // Create a column chart with data source A1:D6
|
|
587
|
+
* // The starting position is upper-left corner of cell B2.
|
|
588
|
+
* // The x-axis title is 'xAxis Title text'.
|
|
589
|
+
* const chartInfo = fWorksheet.newChart()
|
|
512
590
|
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
591
|
+
* .addRange('A1:D6')
|
|
513
592
|
* .setPosition(1, 1, 0, 0)
|
|
514
593
|
* .setXAxisTitle('xAxis Title text')
|
|
515
594
|
* .build();
|
|
516
|
-
*
|
|
595
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
517
596
|
* ```
|
|
518
597
|
*/
|
|
519
598
|
setXAxisTitle(title: string): this;
|
|
@@ -525,14 +604,18 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
525
604
|
* @example
|
|
526
605
|
* ```ts
|
|
527
606
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
528
|
-
* const
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
607
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
608
|
+
*
|
|
609
|
+
* // Create a line chart with data source A1:D6
|
|
610
|
+
* // The starting position is upper-left corner of cell B2.
|
|
611
|
+
* // The y-axis title is 'yAxis Title text'.
|
|
612
|
+
* const chartInfo = fWorksheet.newChart()
|
|
613
|
+
* .asLineChart()
|
|
614
|
+
* .addRange('A1:D6')
|
|
532
615
|
* .setPosition(1, 1, 0, 0)
|
|
533
616
|
* .setYAxisTitle('yAxis Title text')
|
|
534
617
|
* .build();
|
|
535
|
-
*
|
|
618
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
536
619
|
* ```
|
|
537
620
|
*/
|
|
538
621
|
setYAxisTitle(title: string): this;
|
|
@@ -544,14 +627,18 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
544
627
|
* @example
|
|
545
628
|
* ```ts
|
|
546
629
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
547
|
-
* const
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
630
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
631
|
+
*
|
|
632
|
+
* // Create a line chart with data source A1:D6
|
|
633
|
+
* // The starting position is upper-left corner of cell B2.
|
|
634
|
+
* // The right y-axis title is 'rightYAxis Title text'.
|
|
635
|
+
* const chartInfo = fWorksheet.newChart()
|
|
636
|
+
* .asLineChart()
|
|
637
|
+
* .addRange('A1:D6')
|
|
551
638
|
* .setPosition(1, 1, 0, 0)
|
|
552
639
|
* .setRightYAxisTitle('rightYAxis Title text')
|
|
553
640
|
* .build();
|
|
554
|
-
*
|
|
641
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
555
642
|
* ```
|
|
556
643
|
*/
|
|
557
644
|
setRightYAxisTitle(title: string): this;
|
|
@@ -563,14 +650,22 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
563
650
|
* @example
|
|
564
651
|
* ```ts
|
|
565
652
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
566
|
-
* const
|
|
567
|
-
*
|
|
568
|
-
*
|
|
653
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
654
|
+
*
|
|
655
|
+
* // Create a column chart with data source A1:D6
|
|
656
|
+
* // The starting position is upper-left corner of cell B2.
|
|
657
|
+
* // The x-axis style is set.
|
|
658
|
+
* const chartInfo = fWorksheet.newChart()
|
|
569
659
|
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
660
|
+
* .addRange('A1:D6')
|
|
570
661
|
* .setPosition(1, 1, 0, 0)
|
|
571
|
-
* .setXAxisTextStyle({
|
|
662
|
+
* .setXAxisTextStyle({
|
|
663
|
+
* content: 'xAxis Title text',
|
|
664
|
+
* fontSize: 12,
|
|
665
|
+
* fontColor: '#ff0000'
|
|
666
|
+
* })
|
|
572
667
|
* .build();
|
|
573
|
-
*
|
|
668
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
574
669
|
* ```
|
|
575
670
|
*/
|
|
576
671
|
setXAxisTextStyle(textStyle: IChartTextStyle): this;
|
|
@@ -582,14 +677,22 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
582
677
|
* @example
|
|
583
678
|
* ```ts
|
|
584
679
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
585
|
-
* const
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
*
|
|
680
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
681
|
+
*
|
|
682
|
+
* // Create a line chart with data source A1:D6
|
|
683
|
+
* // The starting position is upper-left corner of cell B2.
|
|
684
|
+
* // The y-axis style is set.
|
|
685
|
+
* const chartInfo = fWorksheet.newChart()
|
|
686
|
+
* .asLineChart()
|
|
687
|
+
* .addRange('A1:D6')
|
|
589
688
|
* .setPosition(1, 1, 0, 0)
|
|
590
|
-
* .setYAxisTextStyle({
|
|
689
|
+
* .setYAxisTextStyle({
|
|
690
|
+
* content: 'yAxis Title text',
|
|
691
|
+
* fontSize: 12,
|
|
692
|
+
* fontColor: '#ff0000'
|
|
693
|
+
* })
|
|
591
694
|
* .build();
|
|
592
|
-
*
|
|
695
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
593
696
|
* ```
|
|
594
697
|
*/
|
|
595
698
|
setYAxisTextStyle(textStyle: IChartTextStyle): this;
|
|
@@ -601,10 +704,14 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
601
704
|
* @example
|
|
602
705
|
* ```ts
|
|
603
706
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
604
|
-
* const
|
|
605
|
-
*
|
|
606
|
-
*
|
|
607
|
-
*
|
|
707
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
708
|
+
*
|
|
709
|
+
* // Create a line chart with data source A1:D6
|
|
710
|
+
* // The starting position is upper-left corner of cell B2.
|
|
711
|
+
* // The right y-axis style is set.
|
|
712
|
+
* const chartInfo = fWorksheet.newChart()
|
|
713
|
+
* .asLineChart()
|
|
714
|
+
* .addRange('A1:D6')
|
|
608
715
|
* .setPosition(1, 1, 0, 0)
|
|
609
716
|
* .setRightYAxisTextStyle({
|
|
610
717
|
* content: 'rightYAxis Title text',
|
|
@@ -612,7 +719,7 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
612
719
|
* fontColor: '#ff0000'
|
|
613
720
|
* })
|
|
614
721
|
* .build();
|
|
615
|
-
*
|
|
722
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
616
723
|
* ```
|
|
617
724
|
*/
|
|
618
725
|
setRightYAxisTextStyle(textStyle: IChartTextStyle): this;
|
|
@@ -625,14 +732,18 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
625
732
|
* @example
|
|
626
733
|
* ```ts
|
|
627
734
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
628
|
-
* const
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
735
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
736
|
+
*
|
|
737
|
+
* // Create a line chart with data source A1:D6
|
|
738
|
+
* // The starting position is upper-left corner of cell B2.
|
|
739
|
+
* // The invalid value is set as zero.
|
|
740
|
+
* const chartInfo = fWorksheet.newChart()
|
|
741
|
+
* .asLineChart()
|
|
742
|
+
* .addRange('A1:D6')
|
|
632
743
|
* .setPosition(1, 1, 0, 0)
|
|
633
|
-
* .
|
|
744
|
+
* .setInvalidValueStrategy('zero')
|
|
634
745
|
* .build();
|
|
635
|
-
*
|
|
746
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
636
747
|
* ```
|
|
637
748
|
*/
|
|
638
749
|
setInvalidValueStrategy(invalidValueType: InvalidValueType): this;
|
|
@@ -649,23 +760,27 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
649
760
|
* @example
|
|
650
761
|
* ```ts
|
|
651
762
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
652
|
-
* const
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
763
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
764
|
+
*
|
|
765
|
+
* // Create a line chart with data source A1:D6
|
|
766
|
+
* // The starting position is upper-left corner of cell B2.
|
|
767
|
+
* // The axis pointer style is set.
|
|
768
|
+
* const chartInfo = fWorksheet.newChart()
|
|
769
|
+
* .asLineChart()
|
|
770
|
+
* .addRange('A1:D6')
|
|
656
771
|
* .setPosition(1, 1, 0, 0)
|
|
657
772
|
* .setAxisPointerStyle({
|
|
658
773
|
* indicatorLabelColor: '#ff0000',
|
|
659
|
-
* indicatorLineType: ChartBorderDashType.Solid,
|
|
774
|
+
* indicatorLineType: univerAPI.Enum.ChartBorderDashType.Solid,
|
|
660
775
|
* indicatorLineColor: '#00ff00',
|
|
661
776
|
* indicatorLabelTextColor: '#0000ff',
|
|
662
777
|
* })
|
|
663
778
|
* .build();
|
|
664
|
-
*
|
|
779
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
665
780
|
*
|
|
666
781
|
* // a AxisPointerStyle can be defined like following:
|
|
667
|
-
*
|
|
668
|
-
* .setOptions('axisPointer.indicatorLineType', ChartBorderDashType.Solid)
|
|
782
|
+
* const chartInfo = fWorksheet.newChart().setOptions('axisPointer.indicatorLineColor', '#ff0000')
|
|
783
|
+
* .setOptions('axisPointer.indicatorLineType', univerAPI.Enum.ChartBorderDashType.Solid)
|
|
669
784
|
* .setOptions('axisPointer.indicatorLineColor', '#00ff00')
|
|
670
785
|
* .setOptions('axisPointer.indicatorLabelTextColor', '#0000ff')
|
|
671
786
|
* .build();
|
|
@@ -693,25 +808,27 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
693
808
|
* @example
|
|
694
809
|
* ```ts
|
|
695
810
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
696
|
-
* const
|
|
697
|
-
*
|
|
698
|
-
*
|
|
699
|
-
*
|
|
811
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
812
|
+
*
|
|
813
|
+
* // Create a line chart with data source A1:D6
|
|
814
|
+
* // The starting position is upper-left corner of cell B2.
|
|
815
|
+
* // The all series style is set.
|
|
816
|
+
* const chartInfo = fWorksheet.newChart()
|
|
817
|
+
* .asLineChart()
|
|
818
|
+
* .addRange('A1:D6')
|
|
700
819
|
* .setPosition(1, 1, 0, 0)
|
|
701
|
-
* .
|
|
702
|
-
* chartType: ChartTypeBits.Line,
|
|
820
|
+
* .setAllSeriesStyle({
|
|
703
821
|
* rightYAxis: false,
|
|
704
822
|
* color: '#ff0000',
|
|
705
|
-
* fillOpacity: 0.5,
|
|
706
823
|
* border: {
|
|
707
824
|
* color: '#00ff00',
|
|
708
825
|
* opacity: 0.5,
|
|
709
826
|
* width: 1,
|
|
710
|
-
* dashType: ChartBorderDashType.Solid,
|
|
827
|
+
* dashType: univerAPI.Enum.ChartBorderDashType.Solid,
|
|
711
828
|
* },
|
|
712
829
|
* })
|
|
713
830
|
* .build();
|
|
714
|
-
*
|
|
831
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
715
832
|
* ```
|
|
716
833
|
*/
|
|
717
834
|
setAllSeriesStyle(allSeriesStyle: Partial<IAllSeriesStyle>): this;
|
|
@@ -725,22 +842,27 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
725
842
|
* @example
|
|
726
843
|
* ```ts
|
|
727
844
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
728
|
-
* const
|
|
729
|
-
*
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
845
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
846
|
+
*
|
|
847
|
+
* // Create a line chart with data source A1:D6
|
|
848
|
+
* // The starting position is upper-left corner of cell B2.
|
|
849
|
+
* const chartInfo = fWorksheet.newChart()
|
|
850
|
+
* .asLineChart()
|
|
851
|
+
* .addRange('A1:D6')
|
|
852
|
+
* .setPosition(1, 1, 0, 0)
|
|
853
|
+
* .build();
|
|
854
|
+
* const fChart = await fWorksheet.insertChart(chartInfo);
|
|
855
|
+
*
|
|
856
|
+
* // Update the first series style after 3 seconds.
|
|
733
857
|
* setTimeout(() => {
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
* const first = fChart.getSeriesData()[0];
|
|
738
|
-
* chartBuilder.setSeriesStyle(first.index, {
|
|
858
|
+
* const first = fChart.getSeriesData()[0];
|
|
859
|
+
* const newChartInfo = fWorksheet.newChart(fChart)
|
|
860
|
+
* .setSeriesStyle(first.index, {
|
|
739
861
|
* color: '#ff0000',
|
|
740
|
-
* })
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
* },
|
|
862
|
+
* })
|
|
863
|
+
* .build();
|
|
864
|
+
* fWorksheet.updateChart(newChartInfo);
|
|
865
|
+
* }, 3000);
|
|
744
866
|
* ```
|
|
745
867
|
*/
|
|
746
868
|
setSeriesStyle(index: number | string, seriesStyle: ISeriesStyle): this;
|
|
@@ -752,15 +874,19 @@ export declare class FChartBuilderBase extends FBase {
|
|
|
752
874
|
* @example
|
|
753
875
|
* ```ts
|
|
754
876
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
755
|
-
* const
|
|
756
|
-
*
|
|
757
|
-
*
|
|
877
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
878
|
+
*
|
|
879
|
+
* // Create a column chart with data source A1:D6
|
|
880
|
+
* // The starting position is upper-left corner of cell B2.
|
|
881
|
+
* // The width of the chart is 600 and the height is 400.
|
|
882
|
+
* const chartInfo = fWorksheet.newChart()
|
|
758
883
|
* .setChartType(univerAPI.Enum.ChartType.Column)
|
|
884
|
+
* .addRange('A1:D6')
|
|
759
885
|
* .setPosition(1, 1, 0, 0)
|
|
760
886
|
* .setWidth(600)
|
|
761
887
|
* .setHeight(400)
|
|
762
888
|
* .build();
|
|
763
|
-
*
|
|
889
|
+
* await fWorksheet.insertChart(chartInfo);
|
|
764
890
|
* ```
|
|
765
891
|
*/
|
|
766
892
|
build(): IChartBuilderInfo;
|