Skip to content

Add Control options and styles to remote component. #1393

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 18 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3eafcd5
Fixed background Color and built type structure of gauge chart.
Imiss-U1025 Dec 20, 2024
bb1d2b5
Added Stage Speed Gauge, Grade Gauge, Temperature Gauge chart, Multi …
Imiss-U1025 Dec 20, 2024
4c790a7
Fixed Conditional statements.
Imiss-U1025 Dec 20, 2024
bbdcfe7
Added Stage clock to gauge chart(not editing).
Imiss-U1025 Dec 20, 2024
da4216e
Added dataZoom, grid to candleStick chart.
Imiss-U1025 Dec 20, 2024
a06f57a
Added an editing ability on Stage Gauge chart.
Imiss-U1025 Dec 23, 2024
67c0472
Added an editing ability on Grade Gauge chart.
Imiss-U1025 Dec 24, 2024
7209f93
Added an editing ability on Temperature Gauge chart.
Imiss-U1025 Dec 25, 2024
8c23506
Fixed an editing ability on Temperature Gauge chart.
Imiss-U1025 Dec 26, 2024
5d7020c
Fixed an editing ability on Multi Title and Ring chart.
Imiss-U1025 Dec 26, 2024
ab040d8
Converted repetitive control fields to JSON option, optimize and clea…
Imiss-U1025 Dec 27, 2024
c87b7b3
Fixed an editing ability on Clock chart.
Imiss-U1025 Dec 28, 2024
186aa15
Fixed Clock Pointer Icons on Clock Chart.
Imiss-U1025 Dec 28, 2024
d7e5a2d
Fixed an editing ability on Barometer chart.
Imiss-U1025 Dec 28, 2024
6056207
Fixed some issues and added border and detailSize to Detail Style.
Imiss-U1025 Dec 30, 2024
3d30bad
Fixed a border Radius on styleWrapper.
Imiss-U1025 Dec 30, 2024
0531190
Fixed tooltip and formatters on all gauge chart
Imiss-U1025 Dec 30, 2024
b0078ef
Merge branch 'dev' into feature-funnelChart
raheeliftikhar5 Dec 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ import {
uiChildren,
clickEvent,
styleControl,
EchartsStyle
EchartDefaultChartStyle,
EchartDefaultTextStyle
} from "lowcoder-sdk";
import { RecordConstructorToComp, RecordConstructorToView } from "lowcoder-core";
import { BarChartConfig } from "../chartComp/chartConfigs/barChartConfig";
import { XAxisConfig, YAxisConfig } from "../chartComp/chartConfigs/cartesianAxisConfig";
import { LegendConfig } from "../chartComp/chartConfigs/legendConfig";
import { EchartsLegendConfig } from "../chartComp/chartConfigs/echartsLegendConfig";
import { EchartsLabelConfig } from "../chartComp/chartConfigs/echartsLabelConfig";
import { EchartsTitleConfig } from "comps/chartComp/chartConfigs/echartsTitleConfig";
import { LineChartConfig } from "../chartComp/chartConfigs/lineChartConfig";
import { PieChartConfig } from "../chartComp/chartConfigs/pieChartConfig";
import { ScatterChartConfig } from "../chartComp/chartConfigs/scatterChartConfig";
Expand Down Expand Up @@ -252,15 +254,25 @@ let chartJsonModeChildren: any = {
echartsTitle: withDefault(StringControl, trans("candleStickChart.defaultTitle")),
echartsLegendConfig: EchartsLegendConfig,
echartsLabelConfig: EchartsLabelConfig,
echartsTitleConfig:EchartsTitleConfig,
echartsConfig: EchartsOptionComp,
// style: styleControl(EchartsStyle, 'style'),
left:withDefault(NumberControl,trans('candleStickChart.defaultLeft')),
right:withDefault(NumberControl,trans('candleStickChart.defaultRight')),
top:withDefault(NumberControl,trans('candleStickChart.defaultTop')),
bottom:withDefault(NumberControl,trans('candleStickChart.defaultBottom')),
dataZoomBottom:withDefault(NumberControl,trans('candleStickChart.defaultDataZoomBottom')),
dataZoomHeight:withDefault(NumberControl,trans('candleStickChart.defaultDataZoomHeight')),
tooltip: withDefault(BoolControl, true),
legendVisibility: withDefault(BoolControl, true),
dataZoomVisibility: withDefault(BoolControl, true),
}
if (EchartsStyle) {
if (EchartDefaultChartStyle && EchartDefaultTextStyle) {
chartJsonModeChildren = {
...chartJsonModeChildren,
style: styleControl(EchartsStyle, 'style'),
chartStyle: styleControl(EchartDefaultChartStyle, 'chartStyle'),
titleStyle: styleControl(EchartDefaultTextStyle, 'titleStyle'),
labelStyle: styleControl(EchartDefaultTextStyle, 'labelStyle'),
legendStyle: styleControl(EchartDefaultTextStyle, 'legendStyle'),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,43 @@ export function candleStickChartPropertyView(
</div>
),
})}
{children.echartsTitleConfig.getPropertyView()}
{children.left.propertyView({ label: trans("candleStickChart.left") })}
{children.right.propertyView({ label: trans("candleStickChart.right") })}
{children.top.propertyView({ label: trans("candleStickChart.top") })}
{children.bottom.propertyView({ label: trans("candleStickChart.bottom") })}
{children.legendVisibility.getView() && children.echartsLegendConfig.getPropertyView()}
{children.echartsTitle.propertyView({ label: trans("candleStickChart.title") })}
{children.dataZoomVisibility.getView() && children.dataZoomHeight.propertyView({ label: trans("candleStickChart.dataZoomHeight") })}
{children.dataZoomVisibility.getView() && children.dataZoomBottom.propertyView({ label: trans("candleStickChart.dataZoomBottom") })}
{children.tooltip.propertyView({label: trans("candleStickChart.tooltip")})}
{children.legendVisibility.propertyView({label: trans("candleStickChart.legendVisibility")})}
{children.dataZoomVisibility.propertyView({label: trans("candleStickChart.dataZoomVisibility")})}
</Section>
<Section name={sectionNames.interaction}>
{children.onEvent.propertyView()}
</Section>
<Section name={sectionNames.style}>
{children.style?.getPropertyView()}
</Section>
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}</Section>
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}
</Section>

<Section name={sectionNames.chartStyle}>
{children.chartStyle?.getPropertyView()}
</Section>
<Section name={sectionNames.titleStyle}>
{children.titleStyle?.getPropertyView()}
</Section>
<Section name={sectionNames.labelStyle}>
{children.labelStyle?.getPropertyView()}
</Section>
{
children.legendVisibility.getView() ?
<Section name={sectionNames.legendStyle}>
{children.legendStyle?.getPropertyView()}
</Section> : <></>
}
</>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,38 +135,62 @@ export function getEchartsConfig(
chartSize?: ChartSize,
theme?: any,
): EChartsOptionWithMap {


if (props.mode === "json") {
let opt={
"title": {
"text": props.echartsTitle,
'top': props.echartsLegendConfig.top === 'bottom' ?'top':'bottom',
"left":"center"
"left":props.echartsTitleConfig.top,
"textStyle": {
"fontFamily": props?.titleStyle?.chartFontFamily || theme?.titleStyle?.fontFamily,
"fontSize": props?.titleStyle?.chartTextSize || theme?.titleStyle?.fontSize || '18',
"fontWeight": props?.titleStyle?.chartTextWeight || theme?.titleStyle?.fontWeight,
"color": props?.titleStyle?.chartTextColor || theme?.titleStyle?.fontColor || "#000000",
"fontStyle": props?.titleStyle?.chartFontStyle || theme?.titleStyle?.fontStyle,
"textShadowColor": props?.titleStyle?.chartShadowColor || theme?.titleStyle?.shadowColor,
"textShadowBlur": props?.titleStyle?.chartBoxShadow?.split('px')[0] || theme?.titleStyle?.boxShadow?.split('px')[0],
"textShadowOffsetX": props?.titleStyle?.chartBoxShadow?.split('px')[1] || theme?.titleStyle?.boxShadow?.split('px')[1],
"textShadowOffsetY": props?.titleStyle?.chartBoxShadow?.split('px')[2] || theme?.titleStyle?.boxShadow?.split('px')[2]
}
},
"backgroundColor": parseBackground( props?.style?.background || theme?.style?.background || "#FFFFFF"),
"color": props.echartsOption.data?.map(data => data.color),
"tooltip": props.tooltip&&{
"backgroundColor": parseBackground( props?.chartStyle?.background || theme?.chartStyle?.backgroundColor || "#FFFFFF"),
"color": props?.echartsOption.data?.map(data => data.color),
"tooltip": props?.tooltip&&{
"trigger": "axis",
"axisPointer": {
"type": "cross"
}
},
"grid": {
"left": "10%",
"right": "10%",
"bottom": "10%",
"left": `${props?.left}%`,
"right": `${props?.right}%`,
"bottom": `${props?.bottom}%`,
"top": `${props?.top}%`,
},
"dataZoom": [
{
"show": props?.dataZoomVisibility,
"type": 'slider',
"start": 0,
"end": 100,
"bottom": props?.dataZoomBottom,
'height': props?.dataZoomHeight
}
],
"xAxis": {
"type": "category",
"data": props.echartsOption.xAxis.data
"data": props?.echartsOption.xAxis.data
},
"yAxis": {
"type": "value",
"scale": true
},
"series": [
{
"name": props.echartsConfig.type,
"type": props.echartsConfig.type,
"name": props?.echartsConfig.type,
"type": props?.echartsConfig.type,
"left": "10%",
"top": 60,
"bottom": 60,
Expand All @@ -176,9 +200,9 @@ export function getEchartsConfig(
"gap": 2,
"label": {
"show": true,
"position": props.echartsLabelConfig.top
"position": props?.echartsLabelConfig.top
},
"data": props.echartsOption.data,
"data": props?.echartsOption.data,
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import {
clickEvent,
styleControl,
EchartDefaultChartStyle,
EchartDefaultTextStyle
EchartDefaultTextStyle,
ColorControl,
EchartDefaultDetailStyle
} from "lowcoder-sdk";
import { RecordConstructorToComp, RecordConstructorToView } from "lowcoder-core";
import { BarChartConfig } from "../chartComp/chartConfigs/barChartConfig";
Expand All @@ -34,25 +36,6 @@ import { i18nObjs, trans } from "i18n/comps";
import { GaugeChartConfig } from "../chartComp/chartConfigs/gaugeChartConfig";
import { EchartsTitleConfig } from "comps/chartComp/chartConfigs/echartsTitleConfig";

export const ChartTypeOptions = [
{
label: trans("chart.bar"),
value: "bar",
},
{
label: trans("chart.line"),
value: "line",
},
{
label: trans("chart.scatter"),
value: "scatter",
},
{
label: trans("chart.pie"),
value: "pie",
},
] as const;

export const UIEventOptions = [
{
label: trans("chart.select"),
Expand Down Expand Up @@ -232,6 +215,41 @@ const EchartsOptionMap = {
gauge: GaugeChartConfig,
};

const ChartTypeOptions = [
{
label: trans("chart.default"),
value: "default",
},
{
label: trans("chart.stageGauge"),
value: "stageGauge",
},
{
label: trans("chart.gradeGauge"),
value: "gradeGauge",
},
{
label: trans("chart.temperatureGauge"),
value: "temperatureGauge",
},
{
label: trans("chart.multiGauge"),
value: "multiGauge",
},
{
label: trans("chart.ringGauge"),
value: "ringGauge",
},
{
label: trans("chart.barometerGauge"),
value: "barometerGauge",
},
{
label: trans("chart.clockGauge"),
value: "clockGauge",
},
] as const;

const ChartOptionComp = withType(ChartOptionMap, "bar");
const EchartsOptionComp = withType(EchartsOptionMap, "gauge");
export type CharOptionCompType = keyof typeof ChartOptionMap;
Expand All @@ -251,6 +269,15 @@ export const chartUiModeChildren = {

let chartJsonModeChildren: any = {
echartsOption: jsonControl(toObject, i18nObjs.defaultGaugeChartOption),
stageGaugeOption: jsonControl(toObject, i18nObjs.defaultStageGaugeChartOption),
gradeGaugeOption: jsonControl(toObject, i18nObjs.defaultGradeGaugeChartOption),
temperatureGaugeOption: jsonControl(toObject, i18nObjs.defaultTemperatureGaugeChartOption),
multiTitleGaugeOption: jsonControl(toObject, i18nObjs.defaultMultiTitleGaugeChartOption),
ringGaugeOption: jsonControl(toObject, i18nObjs.defaultRingGaugeChartOption),
clockGaugeOption: jsonControl(toObject, i18nObjs.defaultClockGaugeChartOption),
barometerGaugeOption: jsonControl(toObject, i18nObjs.defaultBarometerGaugeChartOption),

chartType: dropdownControl(ChartTypeOptions, trans("chart.default")),
echartsTitle: withDefault(StringControl, trans("gaugeChart.defaultTitle")),
echartsLegendConfig: EchartsLegendConfig,
echartsLabelConfig: EchartsLabelConfig,
Expand All @@ -267,6 +294,7 @@ let chartJsonModeChildren: any = {
bottom:withDefault(NumberControl,trans('gaugeChart.defaultBottom')),
width:withDefault(NumberControl,trans('gaugeChart.defaultWidth')),
radius:withDefault(NumberControl,trans('gaugeChart.defaultRadius')),
temperatureRadius:withDefault(NumberControl,trans('gaugeChart.defaultTemperatureRadius')),
min:withDefault(NumberControl,trans('gaugeChart.defaultMin')),
max:withDefault(NumberControl,trans('gaugeChart.defaultMax')),
gap:withDefault(NumberControl,trans('gaugeChart.defaultGap')),
Expand All @@ -276,18 +304,43 @@ let chartJsonModeChildren: any = {
endAngle:withDefault(NumberControl,trans('gaugeChart.defaultEndAngle')),
splitNumber:withDefault(NumberControl,trans('gaugeChart.defaultSplitNumber')),
pointerLength:withDefault(NumberControl,trans('gaugeChart.defaultPointerLength')),
barometerPointerLength:withDefault(NumberControl,trans('gaugeChart.defaultBarometerPointerLength')),
pointerWidth:withDefault(NumberControl,trans('gaugeChart.defaultPointerWidth')),
barometerPointerWidth:withDefault(NumberControl,trans('gaugeChart.defaultBarometerPointerWidth')),
pointer_Y:withDefault(NumberControl,trans('gaugeChart.defaultPointer_Y')),
barometerPointer_Y:withDefault(NumberControl,trans('gaugeChart.defaultBarometerPointer_Y')),
pointerIcon:withDefault(StringControl),
gradePointerIcon:withDefault(StringControl, trans('gaugeChart.gradeDefaultPointerIcon')),
clockPointerIcon:withDefault(StringControl, trans('gaugeChart.clockDefaultPointerIcon')),
barometerPointerIcon:withDefault(StringControl, trans('gaugeChart.defaultBarometerPointerIcon')),
multiTitlePointerIcon:withDefault(StringControl, trans('gaugeChart.defaultMultiTitlePointerIcon')),
progressBarWidth:withDefault(NumberControl,trans('gaugeChart.defaultProgressBarWidth')),
axisTickWidth: withDefault(NumberControl, trans('gaugeChart.defaultAxisTickWidth')),
axisTickLength: withDefault(NumberControl, trans('gaugeChart.defaultAxisTickLength')),
axisLabelDistance: withDefault(NumberControl, trans('gaugeChart.defaultAxisLabelDistance')),
axisTickColor: withDefault(ColorControl, trans('gaugeChart.defaultAxisTickColor')),

gradeGaugePointerLength:withDefault(NumberControl,trans('gaugeChart.defaultGradeGaugePointerLength')),
gradeGaugePointerWidth:withDefault(NumberControl,trans('gaugeChart.defaultGradeGaugePointerWidth')),
gradeGaugePointer_Y:withDefault(NumberControl,trans('gaugeChart.defaultGradeGaugePointer_Y')),
stageProgressBarWidth:withDefault(NumberControl,trans('gaugeChart.defaultStageProgressBarWidth')),
temperatureProgressBarWidth:withDefault(NumberControl,trans('gaugeChart.defaultTemperatureProgressBarWidth')),
ringProgressBarWidth:withDefault(NumberControl,trans('gaugeChart.defaultRingProgressBarWidth')),
temperatureAxisLabelDistance:withDefault(NumberControl,trans('gaugeChart.defaultTemperatureAxisLabelDistance')),
stageAxisTickColor: withDefault(ColorControl, trans('gaugeChart.defaultStageAxisTickColor')),
gradeAxisTickColor: withDefault(ColorControl),

}
if (EchartDefaultChartStyle && EchartDefaultTextStyle) {

if (EchartDefaultChartStyle && EchartDefaultTextStyle && EchartDefaultDetailStyle) {
chartJsonModeChildren = {
...chartJsonModeChildren,
chartStyle: styleControl(EchartDefaultChartStyle, 'chartStyle'),
titleStyle: styleControl(EchartDefaultTextStyle, 'titleStyle'),
labelStyle: styleControl(EchartDefaultTextStyle, 'labelStyle'),
legendStyle: styleControl(EchartDefaultTextStyle, 'legendStyle'),
legendStyle: styleControl(EchartDefaultDetailStyle, 'legendStyle'),
axisLabelStyle: styleControl(EchartDefaultTextStyle, 'axisLabelStyle'),
axisLabelStyleOutline: styleControl(EchartDefaultTextStyle, 'axisLabelStyleOutline'),
}
}
const chartMapModeChildren = {
Expand Down
Loading
Loading