Skip to content

Commit

Permalink
fix: fix radar chart grid color
Browse files Browse the repository at this point in the history
  • Loading branch information
etienneburdet committed Mar 19, 2024
1 parent 1c616ff commit 9122e5f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
6 changes: 1 addition & 5 deletions packages/visualizations/src/components/Chart/scales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ const computeGridLineColor: (
) => GridLineOptions['color'] = (display) => (context) => {
if (!context?.scale?.ticks) return 'rgba(0, 0, 0, 0)';
const ticksAbsoluteValues = context.scale.ticks.map((tick) => Math.abs(tick.value));
let minAbsoluteTicksIndex = ticksAbsoluteValues.indexOf(Math.min(...ticksAbsoluteValues));
if (context.scale.type === 'radialLinear') {
// On radar, chartjs compute one supplementary grid line
minAbsoluteTicksIndex -= 1;
}
const minAbsoluteTicksIndex = ticksAbsoluteValues.indexOf(Math.min(...ticksAbsoluteValues));
if (display) {
if (context.index === minAbsoluteTicksIndex) return 'rgba(0, 0, 0, 0.4)';
if (display !== 'single') return 'rgba(0, 0, 0, 0.1)';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
let colorScale: ColorScale;
let aspectRatio: number | undefined;
let maxZoom: number;
let renderTooltip: MapRenderTooltipFunction;
let bbox: BBox | undefined;
let activeShapes: string[] | undefined;
Expand Down Expand Up @@ -73,7 +72,6 @@
colorScale = DEFAULT_COLORSCALE,
legend,
aspectRatio,
maxZoom = 4,
activeShapes,
interactive = defaultInteractive,
emptyValueColor = DEFAULT_COLORS.Default,
Expand Down Expand Up @@ -148,7 +146,6 @@
{source}
{layer}
{aspectRatio}
{maxZoom}
{dataBounds}
{colorScale}
{legend}
Expand Down

0 comments on commit 9122e5f

Please sign in to comment.