d2-charts-api
Advanced tools
Comparing version 25.0.9 to 25.0.10
@@ -8,13 +8,22 @@ 'use strict'; | ||
exports.default = function (series, layout, metaData, dashboard) { | ||
if (layout.hideSubtitle) { | ||
return null; | ||
} | ||
var subtitle = void 0; | ||
var filterTitle = (0, _getFilterTitle2.default)(layout, metaData); | ||
// DHIS2-578: allow for optional custom subtitle | ||
if ((0, _isString2.default)(layout.subtitle)) { | ||
subtitle = { text: layout.subtitle }; | ||
} else { | ||
var filterTitle = (0, _getFilterTitle2.default)(layout, metaData); | ||
switch (layout.type) { | ||
case _.CHART_TYPE_PIE: | ||
case _.CHART_TYPE_GAUGE: | ||
subtitle = (0, _gauge2.default)(series, layout, metaData, dashboard, filterTitle); | ||
break; | ||
default: | ||
subtitle = getDefault(layout, dashboard, filterTitle); | ||
switch (layout.type) { | ||
case _.CHART_TYPE_PIE: | ||
case _.CHART_TYPE_GAUGE: | ||
subtitle = (0, _gauge2.default)(series, layout, metaData, dashboard, filterTitle); | ||
break; | ||
default: | ||
subtitle = getDefault(layout, dashboard, filterTitle); | ||
} | ||
} | ||
@@ -43,2 +52,7 @@ | ||
style: { | ||
// DHIS2-578: dynamically truncate subtitle when it's taking more than 1 line | ||
whiteSpace: 'nowrap', | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis', | ||
fontSize: '14px', | ||
@@ -52,2 +66,7 @@ color: '#555', | ||
style: { | ||
// DHIS2-578: dynamically truncate subtitle when it's taking more than 1 line | ||
whiteSpace: 'nowrap', | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis', | ||
fontSize: '12px' | ||
@@ -54,0 +73,0 @@ } |
{ | ||
"name": "d2-charts-api", | ||
"version": "25.0.9", | ||
"version": "25.0.10", | ||
"description": "DHIS2 charts api", | ||
@@ -5,0 +5,0 @@ "main": "index.html", |
@@ -8,2 +8,7 @@ import isString from 'd2-utilizr/lib/isString'; | ||
style: { | ||
// DHIS2-578: dynamically truncate subtitle when it's taking more than 1 line | ||
whiteSpace: 'nowrap', | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis', | ||
fontSize: '14px', | ||
@@ -17,2 +22,7 @@ color: '#555', | ||
style: { | ||
// DHIS2-578: dynamically truncate subtitle when it's taking more than 1 line | ||
whiteSpace: 'nowrap', | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis', | ||
fontSize: '12px' | ||
@@ -29,13 +39,23 @@ } | ||
export default function (series, layout, metaData, dashboard) { | ||
if (layout.hideSubtitle) { | ||
return null; | ||
} | ||
let subtitle; | ||
const filterTitle = getFilterTitle(layout, metaData); | ||
// DHIS2-578: allow for optional custom subtitle | ||
if (isString(layout.subtitle)) { | ||
subtitle = { text: layout.subtitle }; | ||
} | ||
else { | ||
const filterTitle = getFilterTitle(layout, metaData); | ||
switch(layout.type) { | ||
case CHART_TYPE_PIE: | ||
case CHART_TYPE_GAUGE: | ||
subtitle = getGauge(series, layout, metaData, dashboard, filterTitle); | ||
break; | ||
default: | ||
subtitle = getDefault(layout, dashboard, filterTitle); | ||
switch(layout.type) { | ||
case CHART_TYPE_PIE: | ||
case CHART_TYPE_GAUGE: | ||
subtitle = getGauge(series, layout, metaData, dashboard, filterTitle); | ||
break; | ||
default: | ||
subtitle = getDefault(layout, dashboard, filterTitle); | ||
} | ||
} | ||
@@ -49,2 +69,2 @@ | ||
) : subtitle; | ||
} | ||
} |
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
155273
2343