Skip to content

Commit 59f4812

Browse files
committed
feat(line-chart-native): change styling interface
- Rename 'lineStyles' to 'lines', because we refer to elements in the root of style objects for widgets. - Add style property 'lineColorPalette' and 'customLineStyles' to 'lines' style property. - 'customLineStyles' contains self named line style properties whose values adhere to the line style interface. - Change 'lineColorPalette' to a string, because array style properties are concatenated by the Mendix native client instead of being overridden.
1 parent 9525db2 commit 59f4812

File tree

3 files changed

+70
-46
lines changed

3 files changed

+70
-46
lines changed

styles/native/js/core/widgets/linechart.js

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -109,27 +109,38 @@ export const com_mendix_widget_native_linechart_LineChart = {
109109
relativePositionGrid: "top"
110110
},
111111
},
112-
lineStyles: {
113-
line: {
112+
lines: {
114113
/*
115114
Allowed properties:
116-
- dashArray (string)
117-
- ending ("flat" or "round")
118-
- lineColor (string)
119-
- width (number)
120-
*/
121-
},
122-
marker: {
123-
/*
124-
Allowed properties:
125-
- backgroundColor (string)
126-
- borderColor (string)
127-
- borderWidth (number)
128-
- display ("false" or "underneath" or "onTop")
129-
- size (number)
130-
- symbol ("circle" or "diamond" or "plus" or "minus" or "square" or "star" or "triangleDown" or "triangleUp")
115+
- lineColorPalette (string with array of colors separated by ';')
131116
*/
132-
},
117+
lineColorPalette: Object.values(brand)
118+
.map((color, index, brandColors) => (index === brandColors.length - 1 ? color : `${color};`))
119+
.join(""),
120+
customLineStyles: {
121+
any_custom_line_style_name: {
122+
line: {
123+
/*
124+
Allowed properties:
125+
- dashArray (string)
126+
- ending ("flat" or "round")
127+
- lineColor (string)
128+
- width (number)
129+
*/
130+
},
131+
markers: {
132+
/*
133+
Allowed properties:
134+
- backgroundColor (string)
135+
- borderColor (string)
136+
- borderWidth (number)
137+
- display ("false" or "underneath" or "onTop")
138+
- size (number)
139+
- symbol ("circle" or "diamond" or "plus" or "minus" or "square" or "star" or "triangleDown" or "triangleUp")
140+
*/
141+
}
142+
}
143+
}
133144
},
134145
legend: {
135146
container: {
@@ -154,6 +165,5 @@ export const com_mendix_widget_native_linechart_LineChart = {
154165
fontSize: font.sizeSmall,
155166
fontWeight: font.weightNormal,
156167
},
157-
},
158-
lineColorPalette: Object.values(brand),
168+
}
159169
};

styles/native/ts/core/widgets/linechart.ts

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -111,27 +111,38 @@ export const com_mendix_widget_native_linechart_LineChart: LineChartType = {
111111
relativePositionGrid: "top"
112112
},
113113
},
114-
lineStyles: {
115-
line: {
116-
/*
117-
Allowed properties:
118-
- dashArray (string)
119-
- ending ("flat" or "round")
120-
- lineColor (string)
121-
- width (number)
122-
*/
123-
},
124-
marker: {
125-
/*
126-
Allowed properties:
127-
- backgroundColor (string)
128-
- borderColor (string)
129-
- borderWidth (number)
130-
- display ("false" or "underneath" or "onTop")
131-
- size (number)
132-
- symbol ("circle" or "diamond" or "plus" or "minus" or "square" or "star" or "triangleDown" or "triangleUp")
133-
*/
134-
},
114+
lines: {
115+
/*
116+
Allowed properties:
117+
- lineColorPalette (string with array of colors separated by ';')
118+
*/
119+
lineColorPalette: Object.values(brand)
120+
.map((color, index, brandColors) => (index === brandColors.length - 1 ? color : `${color};`))
121+
.join(""),
122+
customLineStyles: {
123+
any_custom_line_style_name: {
124+
line: {
125+
/*
126+
Allowed properties:
127+
- dashArray (string)
128+
- ending ("flat" or "round")
129+
- lineColor (string)
130+
- width (number)
131+
*/
132+
},
133+
markers: {
134+
/*
135+
Allowed properties:
136+
- backgroundColor (string)
137+
- borderColor (string)
138+
- borderWidth (number)
139+
- display ("false" or "underneath" or "onTop")
140+
- size (number)
141+
- symbol ("circle" or "diamond" or "plus" or "minus" or "square" or "star" or "triangleDown" or "triangleUp")
142+
*/
143+
}
144+
}
145+
}
135146
},
136147
legend: {
137148
container: {
@@ -156,6 +167,5 @@ export const com_mendix_widget_native_linechart_LineChart: LineChartType = {
156167
fontSize: font.sizeSmall,
157168
fontWeight: font.weightNormal,
158169
},
159-
},
160-
lineColorPalette: Object.values(brand), // Array of color strings
170+
}
161171
};

styles/native/ts/types/widgets.d.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ export interface LayoutGridType {
273273
}
274274

275275
// Line chart
276-
export interface LineChartGridStyle {
276+
interface LineChartGridStyle {
277277
backgroundColor?: string;
278278
dashArray?: string;
279279
lineColor?: string;
@@ -333,8 +333,12 @@ export interface LineChartType {
333333
xAxis?: LineChartAxisStyle<"X">;
334334
yAxis?: LineChartAxisStyle<"Y">;
335335
legend?: LineChartLegendStyle;
336-
lineStyles?: { [key: string]: LineChartLineStyle };
337-
lineColorPalette?: string[];
336+
lines?: {
337+
lineColorPalette?: string;
338+
customLineStyles?: {
339+
[key: string]: LineChartLineStyle;
340+
};
341+
};
338342
}
339343

340344
// List view

0 commit comments

Comments
 (0)