sea-chart 0.0.23 → 0.0.24
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/dist/model/bar-stack.js +1 -1
- package/dist/model/bar.js +1 -1
- package/dist/model/combination.js +1 -1
- package/dist/model/compare-bar.js +1 -1
- package/dist/model/completeness.js +1 -1
- package/dist/model/dashboard.js +1 -1
- package/dist/model/generic-model.js +1 -1
- package/dist/model/heat-map.js +1 -1
- package/dist/model/horizontal-bar.js +1 -1
- package/dist/model/index.js +1 -1
- package/dist/settings/widgets/numeric-summary-item.js +11 -6
- package/dist/utils/chart-utils/base-utils.js +1 -1
- package/dist/utils/column-utils.js +3 -3
- package/dist/view/wrapper/area.js +1 -1
- package/dist/view/wrapper/bar-custom.js +1 -1
- package/dist/view/wrapper/bar-group.js +1 -1
- package/dist/view/wrapper/bar.js +1 -1
- package/dist/view/wrapper/chart-component.js +38 -4
- package/dist/view/wrapper/completeness.js +1 -1
- package/dist/view/wrapper/horizontal-bar-group.js +1 -1
- package/dist/view/wrapper/horizontal-bar.js +1 -1
- package/dist/view/wrapper/line-group.js +1 -1
- package/dist/view/wrapper/mirror.js +2 -2
- package/dist/view/wrapper/pie.js +2 -2
- package/dist/view/wrapper/scatter.js +1 -1
- package/package.json +1 -1
package/dist/model/bar-stack.js
CHANGED
package/dist/model/bar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDateColumn, getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
2
|
-
import BaseModel from './base-model';
|
|
3
2
|
import { isBoolean } from '../utils';
|
|
4
3
|
import { CHART_TYPE } from '../constants';
|
|
4
|
+
import BaseModel from './base-model';
|
|
5
5
|
class CompareBar extends BaseModel {
|
|
6
6
|
constructor(options, tables) {
|
|
7
7
|
super({
|
package/dist/model/dashboard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNumber } from 'dtable-utils';
|
|
2
|
-
import BaseModel from './base-model';
|
|
3
2
|
import { isBoolean, getChartConfigValueByKey } from '../utils';
|
|
4
3
|
import { DATE_GRANULATES, DEFAULT_LABEL_FONT_SIZE, GEOLOCATION_GRANULATES, LABEL_POSITION_TYPE, CHART_SUMMARY_TYPE, GENERIC_KEY, CHART_KEY, LEGEND_DIRECTION } from '../constants';
|
|
4
|
+
import BaseModel from './base-model';
|
|
5
5
|
export default class GenericModel extends BaseModel {
|
|
6
6
|
constructor(object) {
|
|
7
7
|
const options = object || {};
|
package/dist/model/heat-map.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isDateColumn, getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
2
|
-
import BaseModel from './base-model';
|
|
3
2
|
import { CHART_TYPE } from '../constants';
|
|
3
|
+
import BaseModel from './base-model';
|
|
4
4
|
class HeatMap extends BaseModel {
|
|
5
5
|
constructor(options, tables) {
|
|
6
6
|
super({
|
package/dist/model/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CHART_TYPE } from '../constants';
|
|
1
2
|
import ChartModel from './chart';
|
|
2
3
|
import User from './user';
|
|
3
4
|
import GenericModel from './generic-model';
|
|
4
|
-
import { CHART_TYPE } from '../constants';
|
|
5
5
|
import Bar from './bar';
|
|
6
6
|
import BarGroup from './bar-group';
|
|
7
7
|
import BarStack from './bar-stack';
|
|
@@ -36,15 +36,13 @@ class NumericSummaryItem extends Component {
|
|
|
36
36
|
setCurrentSelectedOptions,
|
|
37
37
|
currentAxisesIndex
|
|
38
38
|
} = this.props;
|
|
39
|
-
if (!currentSelectedOptions) {
|
|
40
|
-
currentSelectedOptions = [];
|
|
41
|
-
}
|
|
42
39
|
let selectedColumnOption;
|
|
43
|
-
const availableOptions = numericColumnOptions.filter(option => {
|
|
40
|
+
const availableOptions = currentSelectedOptions && numericColumnOptions.filter(option => {
|
|
41
|
+
var _option$column;
|
|
44
42
|
const index = currentSelectedOptions.findIndex(o => Object.values(o)[0] && Object.values(o)[0].key === option.column.key);
|
|
45
43
|
// find current option
|
|
46
44
|
// even index === -1 still return true case it's current selected option
|
|
47
|
-
if (option.column.key === value.column_key) {
|
|
45
|
+
if (((_option$column = option.column) === null || _option$column === void 0 ? void 0 : _option$column.key) === value.column_key) {
|
|
48
46
|
// "addCurrentSelectedOptions" is an async action in react, won't effect loops here
|
|
49
47
|
if (index === -1) {
|
|
50
48
|
addCurrentSelectedOptions(option.column, currentAxisesIndex);
|
|
@@ -88,13 +86,20 @@ class NumericSummaryItem extends Component {
|
|
|
88
86
|
index,
|
|
89
87
|
value,
|
|
90
88
|
numericColumnOptions,
|
|
89
|
+
currentSelectedOptions,
|
|
91
90
|
currentAxisesIndex
|
|
92
91
|
} = this.props;
|
|
93
92
|
const {
|
|
94
93
|
column_key,
|
|
95
94
|
summary_method
|
|
96
95
|
} = value;
|
|
97
|
-
|
|
96
|
+
let selectedColumnOption, availableOptions;
|
|
97
|
+
if (currentSelectedOptions) {
|
|
98
|
+
[selectedColumnOption, availableOptions] = this.getAvailableOptions();
|
|
99
|
+
} else {
|
|
100
|
+
selectedColumnOption = numericColumnOptions.find(option => option.value.key === column_key);
|
|
101
|
+
availableOptions = numericColumnOptions;
|
|
102
|
+
}
|
|
98
103
|
const selectedSummaryMethodOption = this.summaryMethodOptions.find(option => option.value === summary_method);
|
|
99
104
|
const {
|
|
100
105
|
isExpand
|
|
@@ -75,7 +75,7 @@ BaseUtils.isValidExistChart = (tables, chart) => {
|
|
|
75
75
|
|
|
76
76
|
// if current chart is using "groupby_column_key" as key
|
|
77
77
|
// if groupby_column_key is null, still return false
|
|
78
|
-
let groupByColumnKey = config.groupby_column_key;
|
|
78
|
+
let groupByColumnKey = config.groupby_column_key || config.x_axis_column_key || config.vertical_axis_column_key || config.columnKey || config.date_column_key;
|
|
79
79
|
if ([CHART_TYPE.BAR, CHART_TYPE.BAR_GROUP, CHART_TYPE.BAR_CUSTOM, CHART_TYPE.BAR_STACK, CHART_TYPE.LINE, CHART_TYPE.LINE_GROUP, CHART_TYPE.AREA, CHART_TYPE.AREA_GROUP].includes(config.type)) {
|
|
80
80
|
groupByColumnKey = config.x_axis_column_key;
|
|
81
81
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellType, DEFAULT_DATE_FORMAT, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, isNumber, isNumericColumn, getNumberDisplayString } from 'dtable-utils';
|
|
2
|
+
import { COLUMNS_ICON_CONFIG } from 'dtable-utils';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { MIRROR_COLUMN_LIST, CHART_SUMMARY_TYPE } from '../constants';
|
|
2
5
|
import { getClientFormulaDisplayString } from './cell-format-utils';
|
|
3
6
|
import { ChartUtils } from './chart-utils';
|
|
4
|
-
import { MIRROR_COLUMN_LIST, CHART_SUMMARY_TYPE } from '../constants';
|
|
5
|
-
/* eslint-disable react/react-in-jsx-scope */
|
|
6
|
-
import { COLUMNS_ICON_CONFIG } from 'dtable-utils';
|
|
7
7
|
|
|
8
8
|
// get dtable column options
|
|
9
9
|
export function getColumnOptions(columns) {
|
|
@@ -173,7 +173,7 @@ class Area extends ChartComponent {
|
|
|
173
173
|
});
|
|
174
174
|
this.chart.render();
|
|
175
175
|
});
|
|
176
|
-
this.
|
|
176
|
+
this.setToolTipForArea();
|
|
177
177
|
isFunction(customRender) && customRender(this.chart);
|
|
178
178
|
this.setNameLabelAndTooltip(theme, this.labelCount);
|
|
179
179
|
this.setValueLabel(theme);
|
|
@@ -146,7 +146,7 @@ class BarGroup extends ChartComponent {
|
|
|
146
146
|
},
|
|
147
147
|
style: {
|
|
148
148
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
149
|
-
fill: theme.
|
|
149
|
+
fill: theme.labelColor
|
|
150
150
|
},
|
|
151
151
|
position: type === CHART_TYPE.BAR_STACK ? 'middle' : ''
|
|
152
152
|
}).position('name*value').size(singleBarWidth).color(chartBarColor).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
|
package/dist/view/wrapper/bar.js
CHANGED
|
@@ -80,7 +80,7 @@ class Bar extends ChartComponent {
|
|
|
80
80
|
this.chart.interval().label(y_axis_show_value ? 'value' : false, {
|
|
81
81
|
style: {
|
|
82
82
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
83
|
-
fill: theme.
|
|
83
|
+
fill: theme.labelColor
|
|
84
84
|
}
|
|
85
85
|
}).position('name*value').size(singleBarWidth).tooltip('name*value', (name, value) => {
|
|
86
86
|
return {
|
|
@@ -416,6 +416,8 @@ export default class ChartComponent extends Component {
|
|
|
416
416
|
this.getToolTipSettings = () => {
|
|
417
417
|
return {
|
|
418
418
|
showMarkers: false,
|
|
419
|
+
containerTpl: "<div class=\"g2-tooltip\">\n <div class=\"g2-tooltip-title\">{title}</div>\n <ul class=\"g2-tooltip-list\"></ul>\n </div>",
|
|
420
|
+
itemTpl: "<li class=\"g2-tooltip-list-item\">\n <span class=\"g2-tooltip-marker\" style=\"background-color:{color};display:inline-block;\"></span>\n <span class=\"g2-tooltip-name\">{name}</span>\n <span class=\"g2-tooltip-value\">{value}</span>\n </li>",
|
|
419
421
|
domStyles: {
|
|
420
422
|
'g2-tooltip': {
|
|
421
423
|
boxSizing: 'border-box',
|
|
@@ -432,7 +434,12 @@ export default class ChartComponent extends Component {
|
|
|
432
434
|
'g2-tooltip-title': {
|
|
433
435
|
color: '#333333',
|
|
434
436
|
fontSize: '14px',
|
|
435
|
-
paddingBottom: '10px'
|
|
437
|
+
paddingBottom: '10px',
|
|
438
|
+
maxWidth: '160px',
|
|
439
|
+
whiteSpace: 'nowrap',
|
|
440
|
+
overflow: 'hidden',
|
|
441
|
+
lineHeight: '14px',
|
|
442
|
+
textOverflow: 'ellipsis'
|
|
436
443
|
},
|
|
437
444
|
'g2-tooltip-list-item': {
|
|
438
445
|
marginBottom: '8px'
|
|
@@ -441,11 +448,16 @@ export default class ChartComponent extends Component {
|
|
|
441
448
|
width: '12px',
|
|
442
449
|
height: '12px',
|
|
443
450
|
borderRadius: '2px',
|
|
444
|
-
marginBottom: '-1.5px',
|
|
445
451
|
marginRight: '8px'
|
|
446
452
|
},
|
|
447
453
|
'g2-tooltip-name': {
|
|
448
|
-
|
|
454
|
+
display: 'inline-block',
|
|
455
|
+
fontSize: '12px',
|
|
456
|
+
maxWidth: '80px',
|
|
457
|
+
whiteSpace: 'nowrap',
|
|
458
|
+
overflow: 'hidden',
|
|
459
|
+
lineHeight: '12px',
|
|
460
|
+
textOverflow: 'ellipsis'
|
|
449
461
|
},
|
|
450
462
|
'g2-tooltip-value': {
|
|
451
463
|
fontSize: '12px'
|
|
@@ -470,7 +482,29 @@ export default class ChartComponent extends Component {
|
|
|
470
482
|
},
|
|
471
483
|
crosshairs: {
|
|
472
484
|
line: {
|
|
473
|
-
fill: '#
|
|
485
|
+
fill: '#F3F3F3'
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
this.chart.tooltip({
|
|
490
|
+
...settings,
|
|
491
|
+
...lineToolTipSettings
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
this.setToolTipForArea = () => {
|
|
495
|
+
const settings = this.getToolTipSettings();
|
|
496
|
+
const lineToolTipSettings = {
|
|
497
|
+
showCrosshairs: true,
|
|
498
|
+
showTitle: true,
|
|
499
|
+
shared: true,
|
|
500
|
+
showMarkers: true,
|
|
501
|
+
marker: {
|
|
502
|
+
strokeOpacity: 0,
|
|
503
|
+
r: 6
|
|
504
|
+
},
|
|
505
|
+
crosshairs: {
|
|
506
|
+
line: {
|
|
507
|
+
fill: '#F3F3F3'
|
|
474
508
|
}
|
|
475
509
|
}
|
|
476
510
|
};
|
|
@@ -123,7 +123,7 @@ export default function Completeness(props) {
|
|
|
123
123
|
},
|
|
124
124
|
style: {
|
|
125
125
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
126
|
-
fill: theme.
|
|
126
|
+
fill: theme.labelColor
|
|
127
127
|
}
|
|
128
128
|
}).position('name*value').size(singleBarWidth).color(colorField, colorFieldCb).adjust(adjustType).tooltip('name*group_name*value', (name, group_name, value) => {
|
|
129
129
|
return {
|
|
@@ -93,7 +93,7 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
93
93
|
},
|
|
94
94
|
style: {
|
|
95
95
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
96
|
-
fill: theme.
|
|
96
|
+
fill: theme.labelColor
|
|
97
97
|
}
|
|
98
98
|
}).position('name*value').size(singleBarWidth).color(chartBarColor).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
|
|
99
99
|
return {
|
|
@@ -77,7 +77,7 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
77
77
|
this.chart.interval().label(display_data ? 'value' : false, {
|
|
78
78
|
style: {
|
|
79
79
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
80
|
-
fill: theme.
|
|
80
|
+
fill: theme.labelColor
|
|
81
81
|
}
|
|
82
82
|
}).position('name*value')
|
|
83
83
|
// .color(chartBarColor)
|
|
@@ -71,7 +71,7 @@ class LineGroup extends ChartComponent {
|
|
|
71
71
|
const line = this.chart.line().label(y_axis_show_value ? 'value' : false, {
|
|
72
72
|
style: {
|
|
73
73
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
74
|
-
fill: theme.
|
|
74
|
+
fill: theme.labelColor
|
|
75
75
|
}
|
|
76
76
|
}).animate({
|
|
77
77
|
appear: {
|
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { getTableById, getTableColumnByKey, getNumberDisplayString } from 'dtable-utils';
|
|
5
|
-
import ChartComponent from './chart-component';
|
|
6
5
|
import intl from '../../intl';
|
|
7
6
|
import { BaseUtils } from '../../utils';
|
|
8
7
|
import { CHART_SUMMARY_TYPE, TITLE_AMOUNT, DEFAULT_NUMBER_FORMAT_OBJECT, CHART_SUMMARY_SHOW } from '../../constants';
|
|
8
|
+
import ChartComponent from './chart-component';
|
|
9
9
|
class Mirror extends ChartComponent {
|
|
10
10
|
constructor(props) {
|
|
11
11
|
super(props);
|
|
@@ -71,7 +71,7 @@ class Mirror extends ChartComponent {
|
|
|
71
71
|
},
|
|
72
72
|
label: {
|
|
73
73
|
style: {
|
|
74
|
-
fill: themeColors.
|
|
74
|
+
fill: themeColors.labelColor
|
|
75
75
|
},
|
|
76
76
|
formatter: name => {
|
|
77
77
|
let label = name;
|
package/dist/view/wrapper/pie.js
CHANGED
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { CHART_LABEL_POSITIONS, CHART_LABEL_FORMATS } from '../../constants';
|
|
4
4
|
import { BaseUtils, isFunction } from '../../utils';
|
|
5
|
-
import ChartComponent from './chart-component';
|
|
6
5
|
import intl from '../../intl';
|
|
6
|
+
import ChartComponent from './chart-component';
|
|
7
7
|
class Pie extends ChartComponent {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
@@ -56,7 +56,7 @@ class Pie extends ChartComponent {
|
|
|
56
56
|
custom: true,
|
|
57
57
|
itemName: {
|
|
58
58
|
style: {
|
|
59
|
-
fill: theme.
|
|
59
|
+
fill: theme.labelColor
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
items: newData.map((obj, index) => {
|
|
@@ -83,7 +83,7 @@ export function Scatter(props) {
|
|
|
83
83
|
currentChart.chart.point().position('name*value').label(y_axis_show_value ? 'value' : false, {
|
|
84
84
|
style: {
|
|
85
85
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
86
|
-
fill:
|
|
86
|
+
fill: theme.labelColor
|
|
87
87
|
}
|
|
88
88
|
}).color('groupby', groupby => {
|
|
89
89
|
if (groupby[0] === 'groupby') {
|