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
Fixed the ability to input static/dynamic data via data fields added.
  • Loading branch information
Imiss-U1025 committed Jan 19, 2025
commit 3af9b0265f02b5978d8ed56fc4099ed710fbf43e
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ 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.echartsData : transformData(props.echartsData, props.xAxisKey, seriesColumnNames)
||
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.data : transformData(props.data, props.xAxisKey, seriesColumnNames);
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.echartsData.length && props.echartsData || props.data : transformData(props.echartsData.length && props.echartsData || props.data, props.xAxisKey, seriesColumnNames);
config = {
...config,
dataset: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export function getEchartsConfig(
}
},
backgroundColor: parseBackground( props?.chartStyle?.background || theme?.chartStyle?.backgroundColor || "#FFFFFF"),
color: props?.echartsOption.data?.map(data => data.color),
color: props?.echartsData.data?.map(data => data.color) || props?.echartsOption.data?.map(data => data.color),
tooltip: props?.tooltip && {
trigger: "axis",
axisPointer: {
Expand Down Expand Up @@ -178,7 +178,7 @@ export function getEchartsConfig(
splitArea: props?.axisFlagVisibility && {
show: true,
areaStyle: {
color: props?.echartsOption?.axisColor
color: props?.echartsData?.axisColor || props?.echartsOption?.axisColor
}
},
axisLabel: {
Expand All @@ -187,12 +187,12 @@ export function getEchartsConfig(
},
xAxis: props?.echartsOption && {
type: 'category',
data: props?.echartsOption.xAxis && props?.echartsOption.xAxis.data,
data: props?.echartsData.xAxis && props?.echartsOption.xAxis.data,
splitArea: !props?.axisFlagVisibility && {
show: true,
areaStyle: {
// Provide multiple colors to alternate through
color: props?.echartsOption?.axisColor
color: props?.echartsData?.axisColor || props?.echartsOption?.axisColor
},
},
axisLabel: {
Expand All @@ -205,7 +205,7 @@ export function getEchartsConfig(
},
// Show split areas, each day with a different background color
},
series: props?.echartsOption && [
series: props?.echartsData || props?.echartsOption && [
{
name: props?.echartsConfig.type,
type: props?.echartsConfig.type,
Expand All @@ -214,7 +214,16 @@ export function getEchartsConfig(
position: props?.echartsLabelConfig.top
},
data: props?.echartsData?.data || props?.echartsOption.data,
itemStyle: {
itemStyle: props?.echartsData.itemStyle ? {
...props?.echartsData.itemStyle,
borderWidth: props?.chartStyle?.chartBorderWidth || theme?.chartStyle?.borderWidth,
borderType: props?.chartStyle?.chartBorderStyle || theme?.chartStyle?.borderType,
borderRadius: Number(props?.chartStyle?.chartBorderRadius || theme?.chartStyle?.borderRadius),
shadowColor: props?.chartStyle?.chartShadowColor || theme?.chartStyle?.shadowColor,
shadowBlur: props?.chartStyle?.chartBoxShadow?.split('px')[0] || theme?.chartStyle?.boxShadow?.split('px')[0],
shadowOffsetX: props?.chartStyle?.chartBoxShadow?.split('px')[1] || theme?.chartStyle?.boxShadow?.split('px')[1],
shadowOffsetY: props?.chartStyle?.chartBoxShadow?.split('px')[2] || theme?.chartStyle?.boxShadow?.split('px')[2]
} : {
...props?.echartsOption.itemStyle,
borderWidth: props?.chartStyle?.chartBorderWidth || theme?.chartStyle?.borderWidth,
borderType: props?.chartStyle?.chartBorderStyle || theme?.chartStyle?.borderType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ 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.echartsData : transformData(props.echartsData, props.xAxisKey, seriesColumnNames)
||
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.data : transformData(props.data, props.xAxisKey, seriesColumnNames);
yAxisConfig.type === "category" || yAxisConfig.type === "time" ? props.echartsData.length && props.echartsData || props.data : transformData(props.echartsData.length && props.echartsData || props.data, props.xAxisKey, seriesColumnNames);
config = {
...config,
dataset: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ export function getEchartsConfig(
}
},
"backgroundColor": parseBackground( props?.chartStyle?.background || theme?.chartStyle?.backgroundColor || "#FFFFFF"),
"color": props.echartsOption.data?.map(data => data.color),
"color": props.echartsData.data?.map(data => data.color) || props.echartsOption.data?.map(data => data.color),
"tooltip": props.tooltip&&{
"trigger": "item",
"formatter": "{a} <br/>{b} : {c}%"
},
"legend":props.legendVisibility&& {
"data": props.echartsOption.data?.map(data=>data.name),
"data": props.echartsData.data?.map(data=>data.name) || props.echartsOption.data?.map(data=>data.name),
"top": props.echartsLegendConfig.top,
"left": props.echartsLegendAlignConfig.left,
"orient": props.echartsLegendOrientConfig.orient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function gaugeChartPropertyView(
const stageGaugePropertyView = (
<>
<Section name={trans("chart.config")}>
{children.echartsData.propertyView({ label: trans("chart.data") })}
{children.gradeGaugeData.propertyView({ label: trans("chart.data") })}
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
{children.echartsTitleConfig.getPropertyView()}
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
Expand Down Expand Up @@ -150,7 +150,7 @@ export function gaugeChartPropertyView(
const gradeGaugePropertyView = (
<>
<Section name={trans("chart.config")}>
{children.echartsData.propertyView({ label: trans("chart.data") })}
{children.gradeGaugeData.propertyView({ label: trans("chart.data") })}
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
{children.echartsTitleConfig.getPropertyView()}
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
Expand Down Expand Up @@ -217,7 +217,7 @@ export function gaugeChartPropertyView(
const temperatureGaugePropertyView = (
<>
<Section name={trans("chart.config")}>
{children.echartsData.propertyView({ label: trans("chart.data") })}
{children.temperatureGaugeData.propertyView({ label: trans("chart.data") })}
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
{children.echartsTitleConfig.getPropertyView()}
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
Expand Down Expand Up @@ -285,7 +285,7 @@ export function gaugeChartPropertyView(
const multiGaugePropertyView = (
<>
<Section name={trans("chart.config")}>
{children.echartsData.propertyView({ label: trans("chart.data") })}
{children.multiTitleGaugeData.propertyView({ label: trans("chart.data") })}
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
{children.echartsTitleConfig.getPropertyView()}
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
Expand Down Expand Up @@ -350,7 +350,7 @@ export function gaugeChartPropertyView(
const ringGaugePropertyView = (
<>
<Section name={trans("chart.config")}>
{children.echartsData.propertyView({ label: trans("chart.data") })}
{children.ringGaugeData.propertyView({ label: trans("chart.data") })}
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
{children.echartsTitleConfig.getPropertyView()}
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
Expand Down Expand Up @@ -405,7 +405,7 @@ export function gaugeChartPropertyView(
const barometerGaugePropertyView = (
<>
<Section name={trans("chart.config")}>
{children.echartsData.propertyView({ label: trans("chart.data") })}
{children.barometerGaugeData.propertyView({ label: trans("chart.data") })}
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
{children.echartsTitleConfig.getPropertyView()}
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
Expand Down Expand Up @@ -464,7 +464,7 @@ export function gaugeChartPropertyView(
const clockGaugePropertyView = (
<>
<Section name={trans("chart.config")}>
{children.echartsData.propertyView({ label: trans("chart.data") })}
{children.clockGaugeData.propertyView({ label: trans("chart.data") })}
{children.chartType.propertyView({label: trans("gaugeChart.chartType"), tooltip: trans("gaugeChart.chartTypeTooltip") })}
{children.echartsTitleConfig.getPropertyView()}
{children.echartsTitle.propertyView({ label: trans("gaugeChart.title"), tooltip: trans("echarts.titleTooltip") })}
Expand Down
Loading