Skip to content

Commit

Permalink
fix: display info msg when no legend is found (DHIS2-147) (#656)
Browse files Browse the repository at this point in the history
* Info message for no legend
  • Loading branch information
martinkrulltott authored Oct 21, 2020
1 parent dc9ab00 commit 19d7860
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/visualizations/config/adapters/dhis_highcharts/legendSet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import isNumeric from 'd2-utilizr/lib/isNumeric'
import i18n from '@dhis2/d2-i18n'

import { getLegendByValueFromLegendSet } from "../../../../modules/legends"

Expand Down Expand Up @@ -33,8 +34,12 @@ export const applyLegendSet = (seriesObj, legendSet) =>
: { ...seriesObj }

export const getLegendSetTooltip = () => ({
useHTML: true,
pointFormat: `<span style="color:{point.color}">●</span> ` +
`{series.name}: <b>{point.y}</b><br>` +
`{point.legendSet}: <b>{point.legend}</b>`
pointFormatter: function() {
return (
`<span style="color:${this.color}">●</span> ${this.series.name}: <b>${this.y}</b><br>` +
(this.legend
? `${this.legendSet}: <b>${this.legend}</b>`
: `${i18n.t('No legend for this series')}`)
)
},
})

0 comments on commit 19d7860

Please sign in to comment.