Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
fix: gradient not working when y axis title has space (#98)
Browse files Browse the repository at this point in the history
* fix: gradient not working when y axis title has space

* fix: pass theme

* fix: pass theme
  • Loading branch information
kristw committed May 16, 2019
1 parent e0b5a3f commit b0a342a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable sort-keys, no-magic-numbers, complexity */

import React, { PureComponent } from 'react';
import { kebabCase, groupBy, flatMap, uniqueId, values } from 'lodash';
import {
AreaSeries,
LinearGradient,
Expand All @@ -11,7 +12,7 @@ import {
} from '@data-ui/xy-chart';
import { chartTheme, ChartTheme } from '@data-ui/theme';
import { Margin, Dimension } from '@superset-ui/dimension';
import { groupBy, flatMap, uniqueId, values } from 'lodash';

import { createSelector } from 'reselect';
import createTooltip from './createTooltip';
import XYChartLayout from '../utils/XYChartLayout';
Expand Down Expand Up @@ -95,7 +96,7 @@ class LineChart extends PureComponent<Props> {
const firstDatum = seriesData[0];
const key = fieldNames.map(f => firstDatum[f]).join(',');
const series: Series = {
key: key.length === 0 ? channels.y.getTitle() : key,
key: kebabCase(key.length === 0 ? channels.y.definition.field : key),
color: channels.color.encode(firstDatum, '#222'),
fill: channels.fill.encode(firstDatum, false),
strokeDasharray: channels.strokeDasharray.encode(firstDatum, ''),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ChartProps } from '@superset-ui/chart';

export default function transformProps(chartProps: ChartProps) {
const { width, height, formData, payload } = chartProps;
const { encoding, margin } = formData;
const { encoding, margin, theme } = formData;
const { data } = payload;

return {
Expand All @@ -13,5 +13,6 @@ export default function transformProps(chartProps: ChartProps) {
height,
encoding,
margin,
theme,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ChartProps } from '@superset-ui/chart';

export default function transformProps(chartProps: ChartProps) {
const { width, height, formData, payload } = chartProps;
const { encoding, commonEncoding, margin } = formData;
const { encoding, commonEncoding, margin, theme } = formData;
const { data } = payload;

return {
Expand All @@ -14,5 +14,6 @@ export default function transformProps(chartProps: ChartProps) {
encoding,
commonEncoding,
margin,
theme,
};
}

0 comments on commit b0a342a

Please sign in to comment.