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
}
case 'single-stat':
case 'line-plus-single-stat':
case 'table': {
colors = stringifyColorValues(thresholdsListColors)
break
}
case 'bar':
case 'line':
case 'line-plus-single-stat':
case 'line-stacked':
case 'line-stepplot': {
colors = stringifyColorValues(lineColors)

View File

@ -26,10 +26,7 @@ import {
highlightSeriesOpts,
} from 'src/shared/graphs/helpers'
import {
DEFAULT_LINE_COLORS,
getLineColorsHexes,
} from 'src/shared/constants/graphColorPalettes'
import {getLineColorsHexes} from 'src/shared/constants/graphColorPalettes'
const {LINEAR, LOG, BASE_10, BASE_2} = AXES_SCALE_OPTIONS
import {colorsStringSchema} from 'shared/schemas'
@ -196,16 +193,11 @@ class Dygraph extends Component {
}
colorDygraphSeries = () => {
const {dygraphSeries, children, colors, overrideLineColors} = this.props
const {dygraphSeries, colors, overrideLineColors} = this.props
const numSeries = Object.keys(dygraphSeries).length
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) {
lineColors = getLineColorsHexes(overrideLineColors, numSeries)
}