@orbcharts/plugins-basic 3.0.0-alpha.36 → 3.0.0-alpha.37

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.
@@ -4,6 +4,7 @@ export declare const DEFAULT_LINES_PARAMS: LinesParams;
4
4
  export declare const DEFAULT_DOTS_PARAMS: DotsParams;
5
5
  export declare const DEFAULT_GROUP_AREA_PARAMS: GroupAuxParams;
6
6
  export declare const DEFAULT_BARS_PARAMS: BarsParams;
7
+ export declare const DEFAULT_BARS_DIVERGING_PARAMS: BarsParams;
7
8
  export declare const DEFAULT_BAR_STACK_PARAMS: BarStackParams;
8
9
  export declare const DEFAULT_BARS_TRIANGLE_PARAMS: BarsTriangleParams;
9
10
  export declare const DEFAULT_GROUP_AXIS_PARAMS: GroupAxisParams;
@@ -2,6 +2,7 @@ export * from './defaults';
2
2
  export * from './types';
3
3
  export { Lines } from './plugins/Lines';
4
4
  export { Bars } from './plugins/Bars';
5
+ export { BarsDiverging } from './plugins/BarsDiverging';
5
6
  export { BarStack } from './plugins/BarStack';
6
7
  export { BarsTriangle } from './plugins/BarsTriangle';
7
8
  export { Dots } from './plugins/Dots';
@@ -0,0 +1 @@
1
+ export declare const BarsDiverging: import('@orbcharts/core').PluginConstructor<"grid", string, import('..').BarsParams>;
@@ -27,6 +27,8 @@ export interface BarsParams {
27
27
  barGroupPadding: number;
28
28
  barRadius: number | boolean;
29
29
  }
30
+ export interface BarsDivergingParams extends BarsParams {
31
+ }
30
32
  export interface BarStackParams {
31
33
  barWidth: number;
32
34
  barGroupPadding: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbcharts/plugins-basic",
3
- "version": "3.0.0-alpha.36",
3
+ "version": "3.0.0-alpha.37",
4
4
  "description": "plugins for OrbCharts",
5
5
  "author": "Blue Planet Inc.",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "vite-plugin-dts": "^3.7.3"
36
36
  },
37
37
  "dependencies": {
38
- "@orbcharts/core": "^3.0.0-alpha.35",
38
+ "@orbcharts/core": "^3.0.0-alpha.36",
39
39
  "d3": "^7.8.5",
40
40
  "rxjs": "^7.8.1"
41
41
  }
@@ -116,6 +116,10 @@ function renderLinearAxis ({ selection, yAxisClassName, textClassName, fullParam
116
116
 
117
117
  const valueLength = minAndMax[1] - minAndMax[0]
118
118
 
119
+ // const _valueScale = d3.scaleLinear()
120
+ // .domain([0, 150])
121
+ // .range([416.5, 791.349])
122
+
119
123
  // 設定Y軸刻度
120
124
  const yAxis = d3.axisLeft(valueScale)
121
125
  .scale(valueScale)
@@ -365,6 +369,7 @@ export const createBaseValueAxis: BasePluginFn<BaseLinesContext> = (pluginName:
365
369
  // 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
366
370
  switchMap(async (d) => d),
367
371
  ).subscribe(data => {
372
+ console.log(data)
368
373
 
369
374
  const valueScale: d3.ScaleLinear<number, number> = createAxisLinearScale({
370
375
  maxValue: data.minAndMax[1],
@@ -43,6 +43,10 @@ export const DEFAULT_BARS_PARAMS: BarsParams = {
43
43
  barRadius: false,
44
44
  }
45
45
 
46
+ export const DEFAULT_BARS_DIVERGING_PARAMS: BarsParams = {
47
+ ...DEFAULT_BARS_PARAMS
48
+ }
49
+
46
50
  export const DEFAULT_BAR_STACK_PARAMS: BarStackParams = {
47
51
  barWidth: 0,
48
52
  barGroupPadding: 10,
package/src/grid/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from './defaults'
2
2
  export * from './types'
3
3
  export { Lines } from './plugins/Lines'
4
4
  export { Bars } from './plugins/Bars'
5
+ export { BarsDiverging } from './plugins/BarsDiverging'
5
6
  export { BarStack } from './plugins/BarStack'
6
7
  export { BarsTriangle } from './plugins/BarsTriangle'
7
8
  export { Dots } from './plugins/Dots'
@@ -0,0 +1,39 @@
1
+ import {
2
+ of,
3
+ Subject,
4
+ Observable } from 'rxjs'
5
+ import {
6
+ defineGridPlugin } from '@orbcharts/core'
7
+ import { DEFAULT_BARS_PARAMS } from '../defaults'
8
+ import { createBaseBars } from '../../base/BaseBars'
9
+
10
+ const pluginName = 'BarsDiverging'
11
+
12
+ export const BarsDiverging = defineGridPlugin(pluginName, DEFAULT_BARS_PARAMS)(({ selection, name, subject, observer }) => {
13
+ const destroy$ = new Subject()
14
+
15
+ const unsubscribeBaseBars = createBaseBars(pluginName, {
16
+ selection,
17
+ computedData$: observer.computedData$,
18
+ visibleComputedData$: observer.visibleComputedData$,
19
+ existedSeriesLabels$: observer.existedSeriesLabels$,
20
+ SeriesDataMap$: observer.SeriesDataMap$,
21
+ GroupDataMap$: observer.GroupDataMap$,
22
+ fullParams$: observer.fullParams$,
23
+ fullChartParams$: observer.fullChartParams$,
24
+ gridAxesTransform$: observer.gridAxesTransform$,
25
+ gridGraphicTransform$: observer.gridGraphicTransform$,
26
+ gridGraphicReverseScale$: observer.gridGraphicReverseScale$,
27
+ gridAxesSize$: observer.gridAxesSize$,
28
+ gridHighlight$: observer.gridHighlight$,
29
+ gridContainer$: observer.gridContainer$,
30
+ // isSeriesPositionSeprate$: observer.isSeriesPositionSeprate$,
31
+ isSeriesPositionSeprate$: of(true), // hack: 永遠為true,可以強制讓每組series的bars的x位置都是一樣的
32
+ event$: subject.event$,
33
+ })
34
+
35
+ return () => {
36
+ destroy$.next(undefined)
37
+ unsubscribeBaseBars()
38
+ }
39
+ })
package/src/grid/types.ts CHANGED
@@ -43,6 +43,8 @@ export interface BarsParams {
43
43
  barRadius: number | boolean
44
44
  }
45
45
 
46
+ export interface BarsDivergingParams extends BarsParams {}
47
+
46
48
  export interface BarStackParams {
47
49
  barWidth: number
48
50
  barGroupPadding: number
File without changes
File without changes
File without changes