Use line colors for a line-plus-single-stat cell

pull/10616/head
Alex P 2018-04-09 15:24:30 -07:00
parent dc3c272f19
commit e78266e3fe
2 changed files with 3 additions and 11 deletions

View File

@ -34,13 +34,13 @@ export const getCellTypeColors = ({
break break
} }
case 'single-stat': case 'single-stat':
case 'line-plus-single-stat':
case 'table': { case 'table': {
colors = stringifyColorValues(thresholdsListColors) colors = stringifyColorValues(thresholdsListColors)
break break
} }
case 'bar': case 'bar':
case 'line': case 'line':
case 'line-plus-single-stat':
case 'line-stacked': case 'line-stacked':
case 'line-stepplot': { case 'line-stepplot': {
colors = stringifyColorValues(lineColors) colors = stringifyColorValues(lineColors)

View File

@ -26,10 +26,7 @@ import {
highlightSeriesOpts, highlightSeriesOpts,
} from 'src/shared/graphs/helpers' } from 'src/shared/graphs/helpers'
import { import {getLineColorsHexes} from 'src/shared/constants/graphColorPalettes'
DEFAULT_LINE_COLORS,
getLineColorsHexes,
} from 'src/shared/constants/graphColorPalettes'
const {LINEAR, LOG, BASE_10, BASE_2} = AXES_SCALE_OPTIONS const {LINEAR, LOG, BASE_10, BASE_2} = AXES_SCALE_OPTIONS
import {colorsStringSchema} from 'shared/schemas' import {colorsStringSchema} from 'shared/schemas'
@ -196,16 +193,11 @@ class Dygraph extends Component {
} }
colorDygraphSeries = () => { colorDygraphSeries = () => {
const {dygraphSeries, children, colors, overrideLineColors} = this.props const {dygraphSeries, colors, overrideLineColors} = this.props
const numSeries = Object.keys(dygraphSeries).length const numSeries = Object.keys(dygraphSeries).length
let lineColors = getLineColorsHexes(colors, numSeries) let lineColors = getLineColorsHexes(colors, numSeries)
if (React.children && React.children.count(children)) {
// If graph is line-plus-single-stat then reserve colors for single stat
lineColors = getLineColorsHexes(DEFAULT_LINE_COLORS, numSeries)
}
if (overrideLineColors) { if (overrideLineColors) {
lineColors = getLineColorsHexes(overrideLineColors, numSeries) lineColors = getLineColorsHexes(overrideLineColors, numSeries)
} }