[FE-chart] Add series label option at Mixed chart #413
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import ReactECharts from 'echarts-for-react';
|
import ReactECharts from 'echarts-for-react';
|
||||||
import { getAggregationDataForChart, getGridSize, getLegendOption } from '@/widget/modules/utils/chartUtil';
|
import { getAggregationDataForChart, getGridSize, getLegendOption } from '@/widget/modules/utils/chartUtil';
|
||||||
|
import { AGGREGATION_LIST } from '@/constant';
|
||||||
|
|
||||||
const MixedLinePieChart = props => {
|
const MixedLinePieChart = props => {
|
||||||
const { option, dataSet, axis = 'x', seriesOp, defaultOp, createOp } = props;
|
const { option, dataSet, axis = 'x', seriesOp, defaultOp, createOp } = props;
|
||||||
@@ -48,7 +49,11 @@ const MixedLinePieChart = props => {
|
|||||||
console.log('aggrData : ', aggrData);
|
console.log('aggrData : ', aggrData);
|
||||||
if (item.field) {
|
if (item.field) {
|
||||||
const series = {
|
const series = {
|
||||||
name: option.legendAggregation ? `${item.field} (${item.aggregation})` : item.field,
|
name:
|
||||||
|
(item?.fieldLabel ? item.fieldLabel : item.field) +
|
||||||
|
(option?.legendAggregation
|
||||||
|
? ` (${AGGREGATION_LIST.find(element => element.value === item.aggregation).label})`
|
||||||
|
: ''),
|
||||||
data: aggrData.map(dataItem => dataItem[item.field]),
|
data: aggrData.map(dataItem => dataItem[item.field]),
|
||||||
type: item.type ? item.type : 'line',
|
type: item.type ? item.type : 'line',
|
||||||
color: item.color,
|
color: item.color,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import ReactECharts from 'echarts-for-react';
|
import ReactECharts from 'echarts-for-react';
|
||||||
import { getAggregationDataForChart, getGridSize, getLegendOption } from '@/widget/modules/utils/chartUtil';
|
import { getAggregationDataForChart, getGridSize, getLegendOption } from '@/widget/modules/utils/chartUtil';
|
||||||
|
import { AGGREGATION_LIST } from '@/constant';
|
||||||
|
|
||||||
const LineChart = props => {
|
const LineChart = props => {
|
||||||
const { option, dataSet, axis = 'x', seriesOp, defaultOp, createOp } = props;
|
const { option, dataSet, axis = 'x', seriesOp, defaultOp, createOp } = props;
|
||||||
@@ -49,7 +50,11 @@ const LineChart = props => {
|
|||||||
// console.log('aggrData : ', aggrData);
|
// console.log('aggrData : ', aggrData);
|
||||||
if (item.field && item.type) {
|
if (item.field && item.type) {
|
||||||
const series = {
|
const series = {
|
||||||
name: option.legendAggregation ? `${item.field} (${item.aggregation})` : item.field,
|
name:
|
||||||
|
(item?.fieldLabel ? item.fieldLabel : item.field) +
|
||||||
|
(option?.legendAggregation
|
||||||
|
? ` (${AGGREGATION_LIST.find(element => element.value === item.aggregation).label})`
|
||||||
|
: ''),
|
||||||
data: aggrData.map(dataItem => dataItem[item.field]),
|
data: aggrData.map(dataItem => dataItem[item.field]),
|
||||||
type: item.type,
|
type: item.type,
|
||||||
color: item.color,
|
color: item.color,
|
||||||
|
|||||||
@@ -116,6 +116,14 @@ const MixedLinePieChartSetting = props => {
|
|||||||
onChange={event => handleSeriesChange(event, setOption)}
|
onChange={event => handleSeriesChange(event, setOption)}
|
||||||
endButton={<ColorButtonForm index={index} option={option} setOption={setOption} />}
|
endButton={<ColorButtonForm index={index} option={option} setOption={setOption} />}
|
||||||
/>
|
/>
|
||||||
|
<TextFieldForm
|
||||||
|
id={`fieldLabel${index + 1}`}
|
||||||
|
name={`fieldLabel${index + 1}`}
|
||||||
|
label={`레이블`}
|
||||||
|
value={item.fieldLabel ? item.fieldLabel : ''}
|
||||||
|
onChange={event => handleSeriesChange(event, setOption)}
|
||||||
|
endButton={' '}
|
||||||
|
/>
|
||||||
<SelectForm
|
<SelectForm
|
||||||
id={`aggregation${index + 1}`}
|
id={`aggregation${index + 1}`}
|
||||||
name={`aggregation${index + 1}`}
|
name={`aggregation${index + 1}`}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import ColorButtonForm from '@/components/form/ColorButtonForm';
|
|||||||
import { AddButton, RemoveButton } from '@/components/button/AddIconButton';
|
import { AddButton, RemoveButton } from '@/components/button/AddIconButton';
|
||||||
import { handleAddClick, handleChange, handleRemoveClick, handleSeriesChange } from '@/widget/utils/handler';
|
import { handleAddClick, handleChange, handleRemoveClick, handleSeriesChange } from '@/widget/utils/handler';
|
||||||
import { AGGREGATION_LIST, COLUMN_TYPE, DISPLAY_LIST, LEGEND_LIST, WIDGET_AGGREGATION } from '@/constant';
|
import { AGGREGATION_LIST, COLUMN_TYPE, DISPLAY_LIST, LEGEND_LIST, WIDGET_AGGREGATION } from '@/constant';
|
||||||
|
import TextFieldForm from '@/components/form/TextFieldForm';
|
||||||
|
|
||||||
const MixedLineStackedBarChartSetting = props => {
|
const MixedLineStackedBarChartSetting = props => {
|
||||||
const { option, setOption, axis = 'x', spec } = props;
|
const { option, setOption, axis = 'x', spec } = props;
|
||||||
@@ -61,6 +62,14 @@ const MixedLineStackedBarChartSetting = props => {
|
|||||||
onChange={event => handleSeriesChange(event, setOption)}
|
onChange={event => handleSeriesChange(event, setOption)}
|
||||||
endButton={<ColorButtonForm index={index} option={option} setOption={setOption} />}
|
endButton={<ColorButtonForm index={index} option={option} setOption={setOption} />}
|
||||||
/>
|
/>
|
||||||
|
<TextFieldForm
|
||||||
|
id={`fieldLabel${index + 1}`}
|
||||||
|
name={`fieldLabel${index + 1}`}
|
||||||
|
label={`레이블`}
|
||||||
|
value={item.fieldLabel ? item.fieldLabel : ''}
|
||||||
|
onChange={event => handleSeriesChange(event, setOption)}
|
||||||
|
endButton={' '}
|
||||||
|
/>
|
||||||
<SelectForm
|
<SelectForm
|
||||||
id={`aggregation${index + 1}`}
|
id={`aggregation${index + 1}`}
|
||||||
name={`aggregation${index + 1}`}
|
name={`aggregation${index + 1}`}
|
||||||
@@ -81,7 +90,7 @@ const MixedLineStackedBarChartSetting = props => {
|
|||||||
required={true}
|
required={true}
|
||||||
id={`type${index + 1}`}
|
id={`type${index + 1}`}
|
||||||
name={`type${index + 1}`}
|
name={`type${index + 1}`}
|
||||||
label={`종류 ${index + 1}`}
|
label={`종류`}
|
||||||
optionList={chartTypeList}
|
optionList={chartTypeList}
|
||||||
value={item.type}
|
value={item.type}
|
||||||
onChange={event => handleSeriesChange(event, setOption)}
|
onChange={event => handleSeriesChange(event, setOption)}
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ const WidgetViewer = props => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const renderTitle = () => {
|
const renderTitle = () => {
|
||||||
if (widgetType === WIDGET_TYPE.BOARD_NUMERIC && widgetOption.header?.titleHidden) {
|
if (widgetOption?.header?.titleHidden) {
|
||||||
return '';
|
return '';
|
||||||
} else {
|
} else {
|
||||||
return title;
|
return title;
|
||||||
|
|||||||
Reference in New Issue
Block a user