Skip to content

Remote Chart #1451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 19, 2025
Merged
Prev Previous commit
Next Next commit
Completed the ability to input static/dynamic data via data fields ad…
…ded to all charts.
  • Loading branch information
Imiss-U1025 committed Jan 19, 2025
commit ad00227d5439b47ef5af062b4fc59f84dbd33246
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export const chartUiModeChildren = {
};

let chartJsonModeChildren: any = {
echartsData: withDefault(StringControl, trans("echarts.defaultTitle")),
echartsData: jsonControl(toJSONObjectArray),
echartsOption: jsonControl(toObject, i18nObjs.defaultEchartsJsonOption),
echartsTitle: withDefault(StringControl, trans("echarts.defaultTitle")),
echartsLegendConfig: EchartsLegendConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ export function getEchartsConfig(
.map((s) => s.getView().columnName);
// y-axis is category and time, data doesn't need to aggregate
const transformedData =
yAxisConfig.type === "category" || yAxisConfig.type === "time"
? props.data
: transformData(props.data, props.xAxisKey, seriesColumnNames);
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.echartsData : transformData(props.echartsData, props.xAxisKey, seriesColumnNames)
||
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.data : transformData(props.data, props.xAxisKey, seriesColumnNames);
config = {
...config,
dataset: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export const chartUiModeChildren = {
};

let chartJsonModeChildren: any = {
echartsData: withDefault(StringControl, trans("candleStickChart.defaultTitle")),
echartsData: jsonControl(toObject),
echartsOption: jsonControl(toObject, i18nObjs.defaultCandleStickChartOption),
echartsTitle: withDefault(StringControl, trans("candleStickChart.defaultTitle")),
echartsTitleVerticalConfig: EchartsTitleVerticalConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export function getEchartsConfig(
show: true,
position: props?.echartsLabelConfig.top
},
data: props?.echartsOption.data,
data: props?.echartsData?.data || props?.echartsOption.data,
itemStyle: {
...props?.echartsOption.itemStyle,
borderWidth: props?.chartStyle?.chartBorderWidth || theme?.chartStyle?.borderWidth,
Expand All @@ -227,7 +227,7 @@ export function getEchartsConfig(
},
],
}
return props.echartsOption ? opt : {};
return props.echartsData || props.echartsOption ? opt : {};

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export const chartUiModeChildren = {
};

let chartJsonModeChildren: any = {
echartsData: withDefault(StringControl, trans("echarts.defaultTitle")),
echartsData: jsonControl(toJSONObjectArray),
echartsTitle: withDefault(StringControl, trans("echarts.defaultTitle")),
echartsOption: jsonControl(toObject, i18nObjs.defaultEchartsJsonOption),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export function getEchartsConfig(
theme?: any,
): EChartsOptionWithMap {
if (props.mode === "json") {
return props.echartsOption ? props.echartsOption : {};
return props.echartsOption || props.echartsOption ? props.echartsOption : {};
}
if(props.mode === "map") {
const {
Expand Down Expand Up @@ -212,9 +212,9 @@ export function getEchartsConfig(
.map((s) => s.getView().columnName);
// y-axis is category and time, data doesn't need to aggregate
const transformedData =
yAxisConfig.type === "category" || yAxisConfig.type === "time"
? props.data
: transformData(props.data, props.xAxisKey, seriesColumnNames);
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.echartsData : transformData(props.echartsData, props.xAxisKey, seriesColumnNames)
||
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.data : transformData(props.data, props.xAxisKey, seriesColumnNames);
config = {
...config,
dataset: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const chartUiModeChildren = {
};

let chartJsonModeChildren: any = {
echartsData: withDefault(StringControl, trans("funnelChart.defaultTitle")),
echartsData: jsonControl(toObject),
echartsOption: jsonControl(toObject, i18nObjs.defaultFunnelChartOption),
echartsTitle: withDefault(StringControl, trans("funnelChart.defaultTitle")),
echartsTitleVerticalConfig: EchartsTitleVerticalConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ export function getEchartsConfig(
"position": props.echartsLabelConfig.top,
...styleWrapper(props?.labelStyle,theme?.labelStyle, 13),
},
"data": props.echartsOption.data
"data": props?.echartsData?.data || props.echartsOption.data
}
]
}
return props.echartsOption ? opt : {};
return props.echartsData || props.echartsOption ? opt : {};

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export const chartUiModeChildren = {
};

let chartJsonModeChildren: any = {
echartsData: withDefault(StringControl, trans("funnelChart.defaultTitle")),
echartsData: jsonControl(toObject),
echartsOption: jsonControl(toObject, i18nObjs.defaultGaugeChartOption),
stageGaugeOption: jsonControl(toObject, i18nObjs.defaultStageGaugeChartOption),
gradeGaugeOption: jsonControl(toObject, i18nObjs.defaultGradeGaugeChartOption),
Expand All @@ -278,13 +278,13 @@ let chartJsonModeChildren: any = {
clockGaugeOption: jsonControl(toObject, i18nObjs.defaultClockGaugeChartOption),
barometerGaugeOption: jsonControl(toObject, i18nObjs.defaultBarometerGaugeChartOption),

stageGaugeData:withDefault(StringControl, trans("gaugeChart.defaultTitle")),
gradeGaugeData:withDefault(StringControl, trans("gaugeChart.defaultTitle")),
temperatureGaugeData:withDefault(StringControl, trans("gaugeChart.defaultTitle")),
multiTitleGaugeData:withDefault(StringControl, trans("gaugeChart.defaultTitle")),
ringGaugeData:withDefault(StringControl, trans("gaugeChart.defaultTitle")),
clockGaugeData:withDefault(StringControl, trans("gaugeChart.defaultTitle")),
barometerGaugeData:withDefault(StringControl, trans("gaugeChart.defaultTitle")),
stageGaugeData:jsonControl(toObject),
gradeGaugeData:jsonControl(toObject),
temperatureGaugeData:jsonControl(toObject),
multiTitleGaugeData:jsonControl(toObject),
ringGaugeData:jsonControl(toObject),
clockGaugeData:jsonControl(toObject),
barometerGaugeData:jsonControl(toObject),

chartType: dropdownControl(ChartTypeOptions, trans("chart.default")),
echartsTitle: withDefault(StringControl, trans("gaugeChart.defaultTitle")),
Expand Down
Loading