Skip to content

Commit 186ef44

Browse files
malhanpraveenagliga
authored andcommitted
[Snyk] Upgrade highcharts from 11.3.0 to 11.4.8 (#2354)
1 parent 7488837 commit 186ef44

File tree

6 files changed

+27
-17
lines changed

6 files changed

+27
-17
lines changed

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"@floating-ui/dom": "^1.6.12",
7373
"@google/model-viewer": "^4.0.0",
7474
"@marko-tags/subscribe": "^0.5.1",
75-
"highcharts": "11.3.0",
75+
"highcharts": "11.4.8",
7676
"makeup-active-descendant": "0.7.4",
7777
"makeup-expander": "~0.11.4",
7878
"makeup-floating-label": "~0.4.5",

src/common/charts/shared.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const chartFontFamily = '"Market Sans", Arial, sans-serif',
6565
],
6666
// function is used to set up the colors including lineColor(svg stroke) on each of the series objects
6767
// based on the length of the series array
68-
setSeriesColors = function (series: Highcharts.PlotAreaOptions[]) {
68+
setSeriesColors = function (series: Highcharts.SeriesOptions[]) {
6969
const strokeColorMapping = [
7070
chartPrimaryColor,
7171
chartSecondaryColor,
@@ -77,11 +77,17 @@ export const chartFontFamily = '"Market Sans", Arial, sans-serif',
7777
for (let i = 0; i < series.length; i++) {
7878
// Added a modulus in case the user passes in more than 5 series so it doesn't error out
7979
const color = strokeColorMapping[i % strokeColorMapping.length];
80-
series[i].lineColor = color;
81-
series[i].borderColor = color;
82-
series[i].fillOpacity = 1;
80+
if (series[i].type === "bar") {
81+
(series[i] as Highcharts.SeriesBarOptions).borderColor = color;
82+
(series[i] as Highcharts.SeriesBarOptions).color = color;
83+
}
84+
else {
85+
(series[i] as Highcharts.SeriesAreaOptions).lineColor = color;
86+
(series[i] as Highcharts.SeriesAreaOptions).fillOpacity = 1;
87+
}
8388
}
8489
},
90+
8591
setDonutColors = function (series: any) {
8692
const colors = [
8793
{ lineColor: chartPrimaryColor, borderColor: chartPrimaryColor },
@@ -112,7 +118,7 @@ export const chartFontFamily = '"Market Sans", Arial, sans-serif',
112118

113119
return colors.map((color: any) => color.lineColor);
114120
},
115-
setSeriesMarkerStyles = function (series: Highcharts.PlotAreaOptions[]) {
121+
setSeriesMarkerStyles = function (series: Highcharts.SeriesAreaOptions[]) {
116122
series.forEach((s, i) => {
117123
s.zIndex = series.length - i;
118124
s.marker = {

src/components/ebay-bar-chart/component.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface SeriesItem
3232
interface BarChartInput
3333
extends Omit<Marko.Input<"div">, `on${string}` | "title"> {
3434
title: Highcharts.TitleOptions["text"];
35-
description?: Highcharts.PlotSeriesOptions["description"];
35+
description?: Highcharts.SeriesOptionsType["description"];
3636
"x-axis-label-format"?: Highcharts.XAxisLabelsOptions["format"];
3737
"x-axis-positioner"?: Highcharts.XAxisOptions["tickPositioner"];
3838
"y-axis-labels"?: Highcharts.YAxisLabelsOptions["format"][];
@@ -98,6 +98,7 @@ class BarChart extends Marko.Component<Input> {
9898
: [this.input.series];
9999
const stacked = this.input.stacked;
100100
const title = this.input.title;
101+
101102
// controls rounded corders and spacing at the bottom of data points
102103
if (stacked) {
103104
series[0].bottom = true; // set a variable on the first series so it renders rounder corners on the bottom of the bar
@@ -115,7 +116,9 @@ class BarChart extends Marko.Component<Input> {
115116
s.bottom = true;
116117
});
117118
}
118-
setSeriesColors(series);
119+
120+
// Cast series to Highcharts.SeriesBarOptions[] to avoid type errors
121+
setSeriesColors(series as Highcharts.SeriesBarOptions[]);
119122

120123
const config: Highcharts.Options = {
121124
title: {

src/components/ebay-donut-chart/component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { LegendItem } from "../ebay-chart-legend/component";
1111
import type HighchartsTypes from "highcharts";
1212
declare const Highcharts: typeof HighchartsTypes;
1313

14-
interface SeriesDonutOptions extends Omit<Highcharts.SeriesPieOptions, "type"> {
14+
interface SeriesDonutOptions extends Omit<Highcharts.SeriesOptions, "type"> {
1515
data: Highcharts.PointOptionsObject[];
1616
type?: "pie" | "variablepie";
1717
}
@@ -26,7 +26,7 @@ interface DonutChartInput
2626
"cdn-highcharts-pattern-fill"?: string;
2727
version?: string;
2828
series: SeriesDonutOptions[];
29-
highchartsDescription?: Highcharts.PlotSeriesOptions["description"];
29+
highchartsDescription?: string;
3030
}
3131

3232
export interface Input extends WithNormalizedProps<DonutChartInput> {}
@@ -77,7 +77,7 @@ class DonutChart extends Marko.Component<Input> {
7777
*/
7878
_setupChart() {
7979
// Set default type to "pie"
80-
const series = this.input.series.map((series) => ({
80+
const series = this.input.series?.map((series) => ({
8181
...series,
8282
type: series.type || "pie",
8383
})) as Highcharts.SeriesOptionsType[];

src/components/ebay-line-chart/component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ import tooltipTemplate from "./tooltip.marko";
2323
import type HighchartsTypes from "highcharts";
2424
declare const Highcharts: typeof HighchartsTypes;
2525

26-
interface SeriesLineOptions extends Highcharts.SeriesLineOptions {
26+
interface SeriesLineOptions extends Highcharts.PlotLineOptions {
2727
data: Highcharts.PointOptionsObject[];
28+
type: "line",
2829
}
2930

3031
interface LineChartInput
3132
extends Omit<Marko.Input<"div">, `on${string}` | "title"> {
3233
title?: Highcharts.TitleOptions["text"];
33-
description?: Highcharts.PlotSeriesOptions["description"];
34+
description?: Highcharts.PlotLineOptions["description"];
3435
"x-axis-label-format"?: Highcharts.XAxisLabelsOptions["format"];
3536
"x-axis-positioner"?: Highcharts.XAxisOptions["tickPositioner"];
3637
"y-axis-labels"?: Highcharts.YAxisLabelsOptions["format"][];

0 commit comments

Comments
 (0)