d2-charts-api
Advanced tools
Comparing version 32.0.3 to 32.0.4
@@ -49,2 +49,4 @@ 'use strict'; | ||
var _layout = require('../layout'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -69,5 +71,5 @@ | ||
function getIdColorMap(seriesItems, series, layout, extraOptions) { | ||
if ((0, _seriesItems.hasExtraAxisItems)(seriesItems, layout.columns) && (0, _type.isDualAxis)(layout.type)) { | ||
var axisIdsMap = (0, _seriesItems.getAxisIdsMap)(seriesItems, series); | ||
function getIdColorMap(series, layout, extraOptions) { | ||
if ((0, _layout.shouldHaveDualAxis)(layout)) { | ||
var axisIdsMap = (0, _seriesItems.getAxisIdsMap)(layout.seriesItems, series); | ||
var theme = extraOptions.multiAxisTheme; | ||
@@ -103,3 +105,3 @@ | ||
var fullIdAxisMap = (0, _seriesItems.getFullIdAxisMap)(layout.seriesItems, series); | ||
var idColorMap = getIdColorMap(layout.seriesItems, series, layout, extraOptions); | ||
var idColorMap = getIdColorMap(series, layout, extraOptions); | ||
@@ -106,0 +108,0 @@ series.forEach(function (seriesObj, index) { |
@@ -49,3 +49,3 @@ 'use strict'; | ||
var _seriesItems = require('../seriesItems'); | ||
var _layout = require('../layout'); | ||
@@ -114,26 +114,29 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function getDualAxes(theme) { | ||
return [{ | ||
title: { | ||
text: 'Axis 1', | ||
style: { | ||
color: theme[0].mainColor, | ||
'font-weight': 700 | ||
} | ||
} | ||
}, { | ||
title: { | ||
text: 'Axis 2', | ||
style: { | ||
color: theme[1].mainColor, | ||
'font-weight': 700 | ||
} | ||
}, | ||
opposite: true | ||
}]; | ||
} | ||
function getDefault(layout, extraOptions) { | ||
var axes = []; | ||
if ((0, _type.isDualAxis)(layout.type) && (0, _seriesItems.hasExtraAxisItems)(layout.seriesItems, layout.columns)) { | ||
axes.push({ | ||
title: { | ||
text: 'Axis 1', | ||
style: { | ||
color: extraOptions.multiAxisTheme[0].mainColor, | ||
'font-weight': 700 | ||
} | ||
} | ||
}); | ||
axes.push({ | ||
title: { | ||
text: 'Axis 2', | ||
style: { | ||
color: extraOptions.multiAxisTheme[1].mainColor, | ||
'font-weight': 700 | ||
} | ||
}, | ||
opposite: true | ||
}); | ||
if ((0, _layout.shouldHaveDualAxis)(layout)) { | ||
var dualAxes = getDualAxes(extraOptions.multiAxisTheme); | ||
axes.push(dualAxes[0], dualAxes[1]); | ||
} else { | ||
@@ -140,0 +143,0 @@ axes.push((0, _objectClean2.default)({ |
{ | ||
"name": "d2-charts-api", | ||
"version": "32.0.3", | ||
"version": "32.0.4", | ||
"description": "DHIS2 charts api", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,4 +6,5 @@ import getCumulativeData from './../getCumulativeData'; | ||
import { CHART_TYPE_PIE, CHART_TYPE_GAUGE } from '../type'; | ||
import { getFullIdAxisMap, getAxisIdsMap, hasExtraAxisItems } from '../seriesItems'; | ||
import { getFullIdAxisMap, getAxisIdsMap } from '../seriesItems'; | ||
import { generateColors } from '../../../../util/colors/gradientColorGenerator'; | ||
import { shouldHaveDualAxis } from '../layout'; | ||
@@ -27,5 +28,5 @@ const DEFAULT_ANIMATION_DURATION = 200; | ||
function getIdColorMap(seriesItems, series, layout, extraOptions) { | ||
if (hasExtraAxisItems(seriesItems, layout.columns) && isDualAxis(layout.type)) { | ||
const axisIdsMap = getAxisIdsMap(seriesItems, series); | ||
function getIdColorMap(series, layout, extraOptions) { | ||
if (shouldHaveDualAxis(layout)) { | ||
const axisIdsMap = getAxisIdsMap(layout.seriesItems, series); | ||
const theme = extraOptions.multiAxisTheme; | ||
@@ -62,3 +63,3 @@ | ||
const fullIdAxisMap = getFullIdAxisMap(layout.seriesItems, series); | ||
const idColorMap = getIdColorMap(layout.seriesItems, series, layout, extraOptions); | ||
const idColorMap = getIdColorMap(series, layout, extraOptions); | ||
@@ -65,0 +66,0 @@ series.forEach((seriesObj, index) => { |
@@ -6,6 +6,6 @@ import arrayClean from 'd2-utilizr/lib/arrayClean'; | ||
import getAxisTitle from '../getAxisTitle'; | ||
import { CHART_TYPE_GAUGE, isDualAxis } from '../type'; | ||
import { CHART_TYPE_GAUGE } from '../type'; | ||
import getGauge from './gauge'; | ||
import { getIsStacked } from '../type'; | ||
import { hasExtraAxisItems } from '../seriesItems'; | ||
import { shouldHaveDualAxis } from '../layout'; | ||
@@ -88,22 +88,17 @@ const DEFAULT_MIN_VALUE = 0; | ||
function getDefault(layout, extraOptions) { | ||
const axes = []; | ||
if (isDualAxis(layout.type) && | ||
hasExtraAxisItems(layout.seriesItems, layout.columns)) { | ||
axes.push({ | ||
function getDualAxes(theme) { | ||
return [ | ||
{ | ||
title: { | ||
text: 'Axis 1', | ||
style: { | ||
color: extraOptions.multiAxisTheme[0].mainColor, | ||
color: theme[0].mainColor, | ||
'font-weight': 700, | ||
}, | ||
}, | ||
}); | ||
axes.push({ | ||
}, { | ||
title: { | ||
text: 'Axis 2', | ||
style: { | ||
color: extraOptions.multiAxisTheme[1].mainColor, | ||
color: theme[1].mainColor, | ||
'font-weight': 700, | ||
@@ -113,3 +108,12 @@ }, | ||
opposite: true, | ||
}); | ||
} | ||
]; | ||
} | ||
function getDefault(layout, extraOptions) { | ||
const axes = []; | ||
if (shouldHaveDualAxis(layout)) { | ||
const dualAxes = getDualAxes(extraOptions.multiAxisTheme); | ||
axes.push(dualAxes[0], dualAxes[1]); | ||
} | ||
@@ -116,0 +120,0 @@ else { |
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
337952
145
3930