Skip to content

Commit b9fcf92

Browse files
refactor: rename stylingOptions to options to encompass all series options
1 parent b8868e3 commit b9fcf92

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

charts/core/src/Echart/Echart.types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,29 @@ export interface StylingContext {
2424
seriesColor?: string;
2525
}
2626

27-
// to convert an SeriesOption type of echarts into a more structured form aligned with LeafyGreen design standards,
27+
// to convert an SeriesOption type of echarts into a structured form more aligned with LeafyGreen design standards,
2828
// where the 'type', 'name', and 'data' fields are explicitly required and typed,
29-
// and all additional properties related to series styling are encapsulated within the 'stylingOptions' object
29+
// and all additional series properties encapsulated within the 'options' object
3030
interface DisciplinedSeriesOption<EChartType extends SeriesOption> {
3131
type: NonNullable<EChartType['type']>;
3232
name: string;
3333
data: NonNullable<EChartType['data']>;
34-
stylingOptions: Omit<EChartType, 'type' | 'name' | 'data'>;
34+
options: Omit<EChartType, 'type' | 'name' | 'data'>;
3535
}
3636

3737
// all supported series options types disciplined and grouped into a single interface
3838
export interface EChartSeriesOptions {
3939
line: DisciplinedSeriesOption<LineSeriesOption>;
40-
// TODO: to be leveraged in a follow-up PR that adds Bar chart support
40+
// TODO: to be leveraged in a follow-up PR to add Bar chart support
4141
bar: DisciplinedSeriesOption<BarSeriesOption>;
4242
}
4343

4444
// a disciplined substitute for SeriesOption type of echarts limited to the ones supported here
4545
export type EChartSeriesOption = Omit<
4646
ValuesOf<EChartSeriesOptions>,
47-
'stylingOptions'
47+
'options'
4848
> &
49-
ValuesOf<EChartSeriesOptions>['stylingOptions'];
49+
ValuesOf<EChartSeriesOptions>['options'];
5050

5151
/**
5252
* TODO: This might need to be improved. `ComposeOption` appears to make most base option

charts/core/src/Series/Line/Line.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type LineProps = SeriesProps;
88

99
function getDefaultLineOptions(
1010
stylingContext: StylingContext,
11-
): EChartSeriesOptions['line']['stylingOptions'] {
11+
): EChartSeriesOptions['line']['options'] {
1212
return {
1313
showSymbol: false,
1414
symbol: 'circle',
@@ -37,7 +37,7 @@ export const Line = (props: LineProps) => (
3737
type={'line'}
3838
name={props.name}
3939
data={props.data}
40-
stylingOptions={getDefaultLineOptions}
40+
options={getDefaultLineOptions}
4141
/>
4242
);
4343

charts/core/src/Series/Series.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ export function Series<T extends ValuesOf<EChartSeriesOptions>>({
1111
type,
1212
name,
1313
data,
14-
stylingOptions,
14+
options,
1515
}: {
1616
type: T['type'];
1717
name: T['name'];
1818
data: T['data'];
19-
stylingOptions: (ctx: StylingContext) => T['stylingOptions'];
19+
options: (ctx: StylingContext) => T['options'];
2020
}) {
2121
const {
2222
chart: { addSeries, ready, removeSeries },
@@ -35,7 +35,7 @@ export function Series<T extends ValuesOf<EChartSeriesOptions>>({
3535
type,
3636
name,
3737
data,
38-
...stylingOptions(context),
38+
...options(context),
3939
});
4040
} else {
4141
removeSeries(name);
@@ -57,7 +57,7 @@ export function Series<T extends ValuesOf<EChartSeriesOptions>>({
5757
type,
5858
name,
5959
data,
60-
stylingOptions,
60+
options,
6161
]);
6262

6363
return null;

0 commit comments

Comments
 (0)