Skip to content

Commit bbb7f7a

Browse files
Theme: use theme style in candleChartComp
1 parent 61e3963 commit bbb7f7a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

client/packages/lowcoder-comps/src/comps/candleStickChartComp/candleStickChartComp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ CandleStickChartTmpComp = withViewFn(CandleStickChartTmpComp, (comp) => {
144144
const option = useMemo(() => {
145145
return getEchartsConfig(
146146
childrenToProps(echartsConfigChildren) as ToViewReturn<typeof echartsConfigChildren>,
147-
chartSize
147+
chartSize,
148+
theme?.theme?.components?.candleStickChart || {},
148149
);
149150
}, [chartSize, ...Object.values(echartsConfigChildren)]);
150151

client/packages/lowcoder-comps/src/comps/candleStickChartComp/candleStickChartUtils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { chartColorPalette, isNumeric, JSONObject, loadScript } from "lowcoder-s
1212
import { calcXYConfig } from "comps/chartComp/chartConfigs/cartesianAxisConfig";
1313
import Big from "big.js";
1414
import { googleMapsApiUrl } from "../chartComp/chartConfigs/chartUrls";
15+
import { useContext } from "react";
1516

1617
export function transformData(
1718
originData: JSONObject[],
@@ -128,15 +129,19 @@ export function getSeriesConfig(props: EchartsConfigProps) {
128129
}
129130

130131
// https://echarts.apache.org/en/option.html
131-
export function getEchartsConfig(props: EchartsConfigProps, chartSize?: ChartSize): EChartsOptionWithMap {
132+
export function getEchartsConfig(
133+
props: EchartsConfigProps,
134+
chartSize?: ChartSize,
135+
theme?: any,
136+
): EChartsOptionWithMap {
132137
if (props.mode === "json") {
133138
let opt={
134139
"title": {
135140
"text": props.echartsTitle,
136141
'top': props.echartsLegendConfig.top === 'bottom' ?'top':'bottom',
137142
"left":"center"
138143
},
139-
"backgroundColor": props?.style?.background,
144+
"backgroundColor": props?.style?.background || theme.background,
140145
"color": props.echartsOption.data?.map(data => data.color),
141146
"tooltip": props.tooltip&&{
142147
"trigger": "axis",

0 commit comments

Comments
 (0)