sea-chart 2.0.25-alpha.1 → 2.0.25-alpha.2

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.
@@ -649,10 +649,10 @@ class ChartComponent extends _react.Component {
649
649
  this.setContinuousLegend = _ref => {
650
650
  var _this$chart$node2;
651
651
  let {
652
+ theme,
652
653
  colorRange = [],
653
654
  legendDirection,
654
655
  legendSize,
655
- legendTextColor,
656
656
  legendTextRange,
657
657
  bubbleColor,
658
658
  type
@@ -682,14 +682,14 @@ class ChartComponent extends _react.Component {
682
682
  continuousLegendWrapper.append('polygon').attr('points', "0,0 ".concat(legendRectWidth, ",0 0,").concat(legendRectHeight)).attr('fill', '#fff').attr('stroke', '#fff');
683
683
  }
684
684
  });
685
- continuousLegendWrapper.append('text').attr('class', 'range-start').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', legendTextColor).text(legendTextRange[0]).call(g => {
685
+ continuousLegendWrapper.append('text').attr('class', 'range-start').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).text(legendTextRange[0]).call(g => {
686
686
  const {
687
687
  height
688
688
  } = g.node().getBoundingClientRect();
689
689
  g.attr('x', legendDirection === 'vertical' ? legendRectWidth + legendTextOffset : legendTextOffset);
690
690
  g.attr('y', legendDirection === 'vertical' ? height : height + legendRectHeight);
691
691
  });
692
- continuousLegendWrapper.append('text').attr('class', 'range-end').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', legendTextColor).text(legendTextRange[1]).call(g => {
692
+ continuousLegendWrapper.append('text').attr('class', 'range-end').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).text(legendTextRange[1]).call(g => {
693
693
  const {
694
694
  width,
695
695
  height
@@ -96,8 +96,10 @@ class MapBubble extends _chartComponent.default {
96
96
  };
97
97
  this.draw = (data, mapJson) => {
98
98
  const {
99
- chart
99
+ chart,
100
+ globalTheme
100
101
  } = this.props;
102
+ const theme = _constants.CHART_THEME_COLOR[globalTheme];
101
103
  const {
102
104
  map_level = _constants.MAP_LEVEL.COUNTRY,
103
105
  data_color,
@@ -105,7 +107,7 @@ class MapBubble extends _chartComponent.default {
105
107
  legend_direction,
106
108
  summary_method,
107
109
  type,
108
- bubble_color
110
+ bubble_color = '#2a67d1'
109
111
  } = chart.config;
110
112
  const {
111
113
  width: chartWidth,
@@ -130,10 +132,11 @@ class MapBubble extends _chartComponent.default {
130
132
 
131
133
  // draw legend
132
134
  const columnData = this.getColumnData();
135
+ console.log('data_color', data_color);
133
136
  this.setContinuousLegend({
137
+ theme,
134
138
  legendDirection: legend_direction,
135
139
  legendSize: legend_size,
136
- legendTextColor: data_color,
137
140
  legendTextRange: [_utils.BaseUtils.getSummaryValueDisplayString(columnData, d3.min(data, d => d.value), summary_method), _utils.BaseUtils.getSummaryValueDisplayString(columnData, d3.max(data, d => d.value), summary_method)],
138
141
  type,
139
142
  bubbleColor: bubble_color
@@ -168,7 +171,7 @@ class MapBubble extends _chartComponent.default {
168
171
  chart
169
172
  } = this.props;
170
173
  const {
171
- bubble_color
174
+ bubble_color = '#2a67d1'
172
175
  } = chart.config;
173
176
  const circleData = [];
174
177
  mapData.features.forEach(item => {
@@ -195,7 +198,7 @@ class MapBubble extends _chartComponent.default {
195
198
  const percent = value / data.sum;
196
199
  let size = percent * 100;
197
200
  return size;
198
- }).attr('fill', bubble_color || '#2a67d1').attr('fill-opacity', 0.6).attr('stroke', bubble_color || '#2a67d1').attr('stroke-opacity', 0.9).attr('data-value', value).attr('data-name', name).on('click', event => {
201
+ }).attr('fill', bubble_color).attr('fill-opacity', 0.6).attr('stroke', bubble_color).attr('stroke-opacity', 0.9).attr('data-value', value).attr('data-name', name).on('click', event => {
199
202
  const name = event.target.getAttribute('data-name');
200
203
  const newData = data.find(item => item.name.includes(name));
201
204
  newData && this.props.toggleRecords(newData);
@@ -97,8 +97,10 @@ class Map extends _chartComponent.default {
97
97
  };
98
98
  this.draw = (data, mapJson) => {
99
99
  const {
100
- chart
100
+ chart,
101
+ globalTheme
101
102
  } = this.props;
103
+ const theme = _constants.CHART_THEME_COLOR[globalTheme];
102
104
  const {
103
105
  map_level = _constants.MAP_LEVEL.COUNTRY,
104
106
  data_color,
@@ -172,10 +174,10 @@ class Map extends _chartComponent.default {
172
174
  });
173
175
  const columnData = this.getColumnData();
174
176
  this.setContinuousLegend({
177
+ theme,
175
178
  colorRange: exampleColors,
176
179
  legendDirection: legend_direction,
177
180
  legendSize: legend_size,
178
- legendTextColor: data_color,
179
181
  legendTextRange: [_utils.BaseUtils.getSummaryValueDisplayString(columnData, minVal, summary_method), _utils.BaseUtils.getSummaryValueDisplayString(columnData, maxVal, summary_method)]
180
182
  });
181
183
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "2.0.25-alpha.1",
3
+ "version": "2.0.25-alpha.2",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@dnd-kit/core": "^6.1.0",