sea-chart 0.0.40 → 0.0.41-beta.0

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.
@@ -10,6 +10,7 @@ import './index.css';
10
10
  const TypesDialog = _ref => {
11
11
  let {
12
12
  type,
13
+ mediaUrl,
13
14
  onToggle: propsOnToggle,
14
15
  onChange
15
16
  } = _ref;
@@ -44,8 +45,8 @@ const TypesDialog = _ref => {
44
45
  }, [selectedType]);
45
46
  const onSubmit = useCallback(() => {
46
47
  onChange(selectedType);
47
- onToggle();
48
- }, [selectedType, onToggle, onChange]);
48
+ type && onToggle();
49
+ }, [onChange, selectedType, type, onToggle]);
49
50
  return /*#__PURE__*/React.createElement(Modal, {
50
51
  isOpen: true,
51
52
  toggle: onToggle,
@@ -53,7 +54,7 @@ const TypesDialog = _ref => {
53
54
  zIndex: 1048
54
55
  }, /*#__PURE__*/React.createElement(ModalHeader, {
55
56
  toggle: onToggle
56
- }, intl.get('Edit_type')), /*#__PURE__*/React.createElement(ModalBody, {
57
+ }, type ? intl.get('Edit_type') : intl.get('All_charts')), /*#__PURE__*/React.createElement(ModalBody, {
57
58
  className: "sea-chart-types-body"
58
59
  }, /*#__PURE__*/React.createElement("div", {
59
60
  className: "sea-chart-types-container d-flex flex-column h-100"
@@ -101,7 +102,7 @@ const TypesDialog = _ref => {
101
102
  }, intl.get(CHART_TYPE_SHOW[chartType])), /*#__PURE__*/React.createElement("div", {
102
103
  className: "sea-chart-type-image-container"
103
104
  }, /*#__PURE__*/React.createElement("img", {
104
- src: context.getChartImageUrl(chartType),
105
+ src: context.getChartImageUrl(chartType, mediaUrl),
105
106
  alt: "",
106
107
  className: "sea-chart-type-demo-image"
107
108
  })));
package/dist/context.js CHANGED
@@ -101,12 +101,15 @@ class Context {
101
101
  this.getTableFormulaResults = (table, rows, value) => {
102
102
  return this.api.getTableFormulaResults(table, rows, value);
103
103
  };
104
- this.getChartImageUrl = type => {
104
+ this.getChartImageUrl = (type, serverMediaUrl) => {
105
+ const name = CHART_TYPE_IMAGE[type];
106
+ if (serverMediaUrl) {
107
+ return "".concat(serverMediaUrl, "dtable-statistic/img/").concat(name);
108
+ }
105
109
  const {
106
110
  server,
107
111
  mediaUrl
108
112
  } = this.settings;
109
- const name = CHART_TYPE_IMAGE[type];
110
113
  return "".concat(server).concat(mediaUrl, "dtable-statistic/img/").concat(name);
111
114
  };
112
115
  this.api = null;
package/dist/index.js CHANGED
@@ -4,7 +4,8 @@ import { ChartModel } from './model';
4
4
  import View from './view';
5
5
  import Editor from './editor';
6
6
  import Settings, { StyleSettings, Divider } from './settings';
7
+ import TypesDialog from './components/types-dialog';
7
8
  import { ChartDataSQL } from './utils';
8
9
  import Context from './context';
9
10
  export default View;
10
- export { SeaChartAPI, CHART_TYPE, CHART_TYPES, View, Editor, Settings, StyleSettings, Divider, Context, ChartModel, ChartDataSQL };
11
+ export { SeaChartAPI, CHART_TYPE, CHART_TYPES, View, Editor, Settings, TypesDialog, StyleSettings, Divider, Context, ChartModel, ChartDataSQL };
@@ -129,6 +129,7 @@ const en = {
129
129
  "Title": "Title",
130
130
  "Custom_title": "Custom title",
131
131
  "Edit_type": "Edit type",
132
+ "All_charts": "All charts",
132
133
  "Cancel": "Cancel",
133
134
  "Submit": "Submit",
134
135
  "There_are_no_statistic_results_yet": "There are no statistic results yet",
@@ -129,6 +129,7 @@ const zh_CN = {
129
129
  "Title": "标题",
130
130
  "Custom_title": "自定义标题",
131
131
  "Edit_type": "编辑类型",
132
+ "All_charts": "所有图表",
132
133
  "Cancel": "取消",
133
134
  "Submit": "提交",
134
135
  "There_are_no_statistic_results_yet": "目前还没有统计结果",
@@ -428,7 +428,9 @@ export default class ChartComponent extends Component {
428
428
  let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
429
429
  if (!_this.chart) return;
430
430
  const basicLegendConfig = _this.getLegendConfig(theme, legendPosition);
431
- basicLegendConfig.offsetX = offsetX;
431
+ if (offsetX) {
432
+ basicLegendConfig.offsetX = offsetX;
433
+ }
432
434
  basicLegendConfig.itemName.style.fontSize = theme.fontSize;
433
435
  _this.chart.legend(legendName, basicLegendConfig);
434
436
  };
@@ -215,20 +215,7 @@ class Combination extends ChartComponent {
215
215
  } : {
216
216
  type: 'dodge'
217
217
  };
218
- const interval = this.chart.interval().label(display_data ? 'value_left' : false, {
219
- content: data => {
220
- if (this.currentName) {
221
- return data.name === this.currentName ? data.value_left : '';
222
- }
223
- return data.value_left;
224
- },
225
- style: {
226
- fontSize: BaseUtils.getLabelFontSize(label_font_size),
227
- fill: theme.labelColor,
228
- stroke: '#fff',
229
- lineWidth: 1
230
- }
231
- }).position('name*value_left').color('color', color => {
218
+ const interval = this.chart.interval().position('name*value_left').color('color', color => {
232
219
  if (!y_axis_left_group_by_multiple_numeric_column) {
233
220
  return currentTheme.colors[0];
234
221
  }
@@ -370,7 +357,6 @@ class Combination extends ChartComponent {
370
357
  radius: [singleBarRadius, singleBarRadius, 0, 0],
371
358
  fillOpacity: 0.3
372
359
  });
373
- console.log(e);
374
360
  point.style('name', name => {
375
361
  let r = 4;
376
362
  if (name === e.data.data.name) {
@@ -56,8 +56,7 @@ class Pie extends ChartComponent {
56
56
  this.props.toggleRecords(e.data.data);
57
57
  });
58
58
  if (show_legend) {
59
- // lengend itself has a width of nearly 30px, 90 + 30 = 120
60
- this.setLegendForTheta('name', undefined, 'right', -90);
59
+ this.setLegendForTheta('name', undefined, 'right');
61
60
  } else {
62
61
  this.chart.legend(false);
63
62
  }
@@ -60,8 +60,7 @@ class Ring extends ChartComponent {
60
60
  this.props.toggleRecords(e.data.data);
61
61
  });
62
62
  if (show_legend) {
63
- // lengend itself has a width of nearly 30px, 90 + 30 = 120
64
- this.setLegendForTheta('name', undefined, 'right', -90);
63
+ this.setLegendForTheta('name', undefined, 'right');
65
64
  } else {
66
65
  this.chart.legend(false);
67
66
  }
@@ -124,9 +123,11 @@ class Ring extends ChartComponent {
124
123
  stroke: 0
125
124
  }
126
125
  }
127
- }).shape('withGap').style('value', value => {
126
+ })
127
+ // .shape('withGap')
128
+ .style('value', value => {
128
129
  return {
129
- lineWidth: 3,
130
+ lineWidth: 2,
130
131
  stroke: '#fff'
131
132
  };
132
133
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.40",
3
+ "version": "0.0.41-beta.0",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",