@influxdata/giraffe
Advanced tools
Comparing version 0.31.1 to 0.32.0
@@ -1,5 +0,6 @@ | ||
import { Table, ColumnGroupMap, Scale, NumericColumnData, SymbolType } from '../types'; | ||
import { Table, ColumnGroupMap, Scale, NumericColumnData, SymbolType, BandIndexMap } from '../types'; | ||
export declare const createGroupIDColumn: (table: Table, columnKeys: string[]) => [NumericColumnData, ColumnGroupMap]; | ||
export declare const getNominalColorScale: (groupMap: ColumnGroupMap, colors: string[]) => Scale<number, string>; | ||
export declare const getBandColorScale: (bandIndexMap: BandIndexMap, colors: string[]) => Scale<number, string>; | ||
export declare const getContinuousColorScale: (domain: [number, number], colors: string[]) => Scale<number, string>; | ||
export declare const getSymbolScale: (columnGroupMap: ColumnGroupMap) => Scale<number, SymbolType>; |
@@ -227,3 +227,3 @@ import CSS from 'csstype'; | ||
shadeOpacity?: number; | ||
name: string; | ||
mainColumnName: string; | ||
upperColumnName?: string; | ||
@@ -230,0 +230,0 @@ lowerColumnName?: string; |
{ | ||
"name": "@influxdata/giraffe", | ||
"version": "0.31.1", | ||
"version": "0.32.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -355,7 +355,7 @@ # Giraffe | ||
- **name**: _string. Required._ A string indicating the name of the line for the middle part of each band. This **name** must match the result in the data. If no matching name with a result is found, that result will not be rendered. | ||
- **mainColumnName**: _string. Required._ A string indicating the yield name of the line for the middle part of each band. This **mainColumnName** must match the result in the data. If no matching name within the data is found, that result will not be rendered. Only one yield name can be the **mainColumnName** per `<Plot>`. | ||
- **upperColumnName**: _string. Optional._ A string indicating the shaded portion of each band that extends above the **name**d line. | ||
- **upperColumnName**: _string. Optional._ A string indicating the shaded portion of each band that extends above the **mainColumnName** line. | ||
- **lowerColumnName**: _string. Optional._ A string indicating the shaded portion of each band that extends below the **name**d line. | ||
- **lowerColumnName**: _string. Optional._ A string indicating the shaded portion of each band that extends below the **mainColumnName** line. | ||
@@ -362,0 +362,0 @@ - **ScatterLayerConfig**: _Object_. Maximum one per `<Plot>`. Properties are: |
@@ -11,3 +11,3 @@ import { | ||
import {isDefined} from '../utils/isDefined' | ||
import {createGroupIDColumn, getNominalColorScale} from './' | ||
import {createGroupIDColumn, getBandColorScale} from './' | ||
@@ -434,7 +434,11 @@ import {BAND_COLOR_SCALE_CONSTANT} from '../constants' | ||
const yCol = table.getColumn(yColumnKey, 'number') | ||
const bandIndexMap = getBandIndexMap( | ||
fillColumnMap, | ||
lowerColumnName || '', | ||
rowColumnName, | ||
upperColumnName || '' | ||
) | ||
const fillScale = range => | ||
getNominalColorScale( | ||
fillColumnMap, | ||
colors | ||
)(range * BAND_COLOR_SCALE_CONSTANT) | ||
getBandColorScale(bandIndexMap, colors)(range * BAND_COLOR_SCALE_CONSTANT) | ||
const bandFillColors = [] | ||
@@ -469,8 +473,3 @@ const lineData: LineData = {} | ||
type: 'band', | ||
bandIndexMap: getBandIndexMap( | ||
fillColumnMap, | ||
lowerColumnName || '', | ||
rowColumnName, | ||
upperColumnName || '' | ||
), | ||
bandIndexMap, | ||
bandName: rowColumnName, | ||
@@ -477,0 +476,0 @@ inputTable, |
@@ -12,4 +12,5 @@ import {range} from 'd3-array' | ||
SymbolType, | ||
BandIndexMap, | ||
} from '../types' | ||
import {ALL_SYMBOL_TYPES} from '../constants' | ||
import {ALL_SYMBOL_TYPES, BAND_COLOR_SCALE_CONSTANT} from '../constants' | ||
@@ -56,7 +57,7 @@ export const createGroupIDColumn = ( | ||
export const getNominalColorScale = ( | ||
groupMap: ColumnGroupMap, | ||
const createNominalColorScale = ( | ||
length: number, | ||
colors: string[] | ||
): Scale<number, string> => { | ||
const domain = range(groupMap.mappings.length) | ||
const domain = range(length) | ||
@@ -82,2 +83,17 @@ let scaleRange = [] | ||
export const getNominalColorScale = ( | ||
groupMap: ColumnGroupMap, | ||
colors: string[] | ||
): Scale<number, string> => | ||
createNominalColorScale(groupMap.mappings.length, colors) | ||
export const getBandColorScale = ( | ||
bandIndexMap: BandIndexMap, | ||
colors: string[] | ||
): Scale<number, string> => | ||
createNominalColorScale( | ||
bandIndexMap.rowIndices.length * BAND_COLOR_SCALE_CONSTANT, | ||
colors | ||
) | ||
export const getContinuousColorScale = ( | ||
@@ -84,0 +100,0 @@ domain: [number, number], |
@@ -310,3 +310,3 @@ import CSS from 'csstype' | ||
shadeOpacity?: number | ||
name: string | ||
mainColumnName: string | ||
upperColumnName?: string | ||
@@ -313,0 +313,0 @@ lowerColumnName?: string |
@@ -271,3 +271,3 @@ import {newTableFromConfig} from './newTable' | ||
layerConfig.lowerColumnName, | ||
layerConfig.name, | ||
layerConfig.mainColumnName, | ||
layerConfig.upperColumnName | ||
@@ -274,0 +274,0 @@ ) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5234821
741
23369