@orbcharts/plugins-basic 3.0.0-alpha.39 → 3.0.0-alpha.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/dist/orbcharts-plugins-basic.es.js +7449 -7078
  2. package/dist/orbcharts-plugins-basic.umd.js +12 -9
  3. package/dist/src/base/BaseBarStack.d.ts +1 -1
  4. package/dist/src/base/BaseBars.d.ts +1 -1
  5. package/dist/src/base/BaseBarsTriangle.d.ts +1 -1
  6. package/dist/src/base/BaseDots.d.ts +1 -1
  7. package/dist/src/base/BaseLegend.d.ts +1 -0
  8. package/dist/src/base/BaseLineAreas.d.ts +30 -0
  9. package/dist/src/base/BaseLines.d.ts +1 -1
  10. package/dist/src/grid/defaults.d.ts +2 -1
  11. package/dist/src/grid/gridObservables.d.ts +2 -2
  12. package/dist/src/grid/index.d.ts +1 -0
  13. package/dist/src/grid/plugins/LineAreas.d.ts +1 -0
  14. package/dist/src/grid/types.d.ts +5 -0
  15. package/dist/src/multiGrid/types.d.ts +1 -0
  16. package/dist/src/series/types.d.ts +1 -0
  17. package/dist/src/tree/types.d.ts +1 -0
  18. package/dist/src/utils/orbchartsUtils.d.ts +7 -2
  19. package/package.json +2 -2
  20. package/src/base/BaseBarStack.ts +7 -3
  21. package/src/base/BaseBars.ts +7 -3
  22. package/src/base/BaseBarsTriangle.ts +52 -135
  23. package/src/base/BaseDots.ts +7 -3
  24. package/src/base/BaseLegend.ts +16 -1
  25. package/src/base/BaseLineAreas.ts +625 -0
  26. package/src/base/BaseLines.ts +12 -12
  27. package/src/base/BaseValueAxis.ts +0 -1
  28. package/src/grid/defaults.ts +7 -0
  29. package/src/grid/gridObservables.ts +5 -5
  30. package/src/grid/index.ts +1 -0
  31. package/src/grid/plugins/BarStack.ts +1 -1
  32. package/src/grid/plugins/Bars.ts +1 -1
  33. package/src/grid/plugins/BarsDiverging.ts +1 -1
  34. package/src/grid/plugins/BarsTriangle.ts +1 -1
  35. package/src/grid/plugins/Dots.ts +1 -1
  36. package/src/grid/plugins/GroupAux.ts +8 -0
  37. package/src/grid/plugins/LineAreas.ts +37 -0
  38. package/src/grid/plugins/Lines.ts +1 -1
  39. package/src/grid/plugins/ScalingArea.ts +11 -7
  40. package/src/grid/types.ts +6 -1
  41. package/src/multiGrid/defaults.ts +2 -1
  42. package/src/multiGrid/multiGridObservables.ts +6 -6
  43. package/src/multiGrid/plugins/MultiBarStack.ts +1 -1
  44. package/src/multiGrid/plugins/MultiBars.ts +1 -1
  45. package/src/multiGrid/plugins/MultiBarsTriangle.ts +1 -1
  46. package/src/multiGrid/plugins/MultiDots.ts +1 -1
  47. package/src/multiGrid/plugins/MultiLines.ts +1 -1
  48. package/src/multiGrid/types.ts +1 -0
  49. package/src/noneData/defaults.ts +21 -7
  50. package/src/series/defaults.ts +1 -0
  51. package/src/series/types.ts +1 -0
  52. package/src/tree/defaults.ts +1 -0
  53. package/src/tree/plugins/TreeMap.ts +6 -4
  54. package/src/tree/types.ts +1 -0
  55. package/src/utils/orbchartsUtils.ts +22 -8
  56. package/tsconfig.json +1 -1
@@ -32,7 +32,7 @@ interface BaseDotsContext {
32
32
  selection: d3.Selection<any, unknown, any, unknown>
33
33
  computedData$: Observable<ComputedDataGrid>
34
34
  visibleComputedData$: Observable<ComputedDatumGrid[][]>
35
- existedSeriesLabels$: Observable<string[]>
35
+ existSeriesLabels$: Observable<string[]>
36
36
  SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
37
37
  GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
38
38
  fullParams$: Observable<BaseDotsParams>
@@ -257,7 +257,7 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
257
257
  selection,
258
258
  computedData$,
259
259
  visibleComputedData$,
260
- existedSeriesLabels$,
260
+ existSeriesLabels$,
261
261
  SeriesDataMap$,
262
262
  GroupDataMap$,
263
263
  fullParams$,
@@ -416,7 +416,7 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
416
416
  selection,
417
417
  pluginName,
418
418
  clipPathID,
419
- existedSeriesLabels$,
419
+ existSeriesLabels$,
420
420
  gridContainer$,
421
421
  gridAxesTransform$,
422
422
  gridGraphicTransform$
@@ -523,6 +523,7 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
523
523
  pluginName,
524
524
  highlightTarget: data.highlightTarget,
525
525
  datum,
526
+ gridIndex: datum.gridIndex,
526
527
  series: data.SeriesDataMap.get(datum.seriesLabel)!,
527
528
  seriesIndex: datum.seriesIndex,
528
529
  seriesLabel: datum.seriesLabel,
@@ -543,6 +544,7 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
543
544
  highlightTarget: data.highlightTarget,
544
545
  data: data.computedData,
545
546
  datum,
547
+ gridIndex: datum.gridIndex,
546
548
  series: data.SeriesDataMap.get(datum.seriesLabel)!,
547
549
  seriesIndex: datum.seriesIndex,
548
550
  seriesLabel: datum.seriesLabel,
@@ -561,6 +563,7 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
561
563
  pluginName,
562
564
  highlightTarget: data.highlightTarget,
563
565
  datum,
566
+ gridIndex: datum.gridIndex,
564
567
  series: data.SeriesDataMap.get(datum.seriesLabel)!,
565
568
  seriesIndex: datum.seriesIndex,
566
569
  seriesLabel: datum.seriesLabel,
@@ -580,6 +583,7 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
580
583
  pluginName,
581
584
  highlightTarget: data.highlightTarget,
582
585
  datum,
586
+ gridIndex: datum.gridIndex,
583
587
  series: data.SeriesDataMap.get(datum.seriesLabel)!,
584
588
  seriesIndex: datum.seriesIndex,
585
589
  seriesLabel: datum.seriesLabel,
@@ -10,7 +10,7 @@ import {
10
10
  import type { BasePluginFn } from './types'
11
11
  import type {
12
12
  ChartParams, Layout, ColorType } from '@orbcharts/core'
13
- import { getSeriesColor, getClassName, getColor } from '../utils/orbchartsUtils'
13
+ import { getClassName, getColor, getDatumColor } from '../utils/orbchartsUtils'
14
14
  import { measureTextWidth } from '../utils/commonUtils'
15
15
 
16
16
  export interface BaseLegendParams {
@@ -20,6 +20,7 @@ export interface BaseLegendParams {
20
20
  // offset: [number, number]
21
21
  backgroundFill: ColorType
22
22
  backgroundStroke: ColorType
23
+ textColorType: ColorType
23
24
  gap: number
24
25
  seriesList: Array<{
25
26
  listRectWidth: number
@@ -90,6 +91,17 @@ const defaultListStyle: ListStyle = {
90
91
  listRectRadius: 0,
91
92
  }
92
93
 
94
+ function getSeriesColor (seriesIndex: number, fullChartParams: ChartParams) {
95
+ const colorIndex = seriesIndex < fullChartParams.colors[fullChartParams.colorScheme].series.length
96
+ ? seriesIndex
97
+ : seriesIndex % fullChartParams.colors[fullChartParams.colorScheme].series.length
98
+ return fullChartParams.colors[fullChartParams.colorScheme].series[colorIndex]
99
+ }
100
+
101
+ function getLegendColor () {
102
+
103
+ }
104
+
93
105
  export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: string, {
94
106
  rootSelection,
95
107
  seriesLabels$,
@@ -609,6 +621,9 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
609
621
  )
610
622
  .attr('x', data.fullChartParams.styles.textSize * 1.5)
611
623
  .attr('font-size', data.fullChartParams.styles.textSize)
624
+ .attr('fill', d => data.fullParams.textColorType === 'series'
625
+ ? getSeriesColor(d.seriesIndex, data.fullChartParams)
626
+ : getColor(data.fullParams.textColorType, data.fullChartParams))
612
627
  .text(d => d.text)
613
628
  })
614
629
  })