Skip to content

Commit

Permalink
fix: avoid having to read this.userOptions.customSVGOptions for all v…
Browse files Browse the repository at this point in the history
…iz types
  • Loading branch information
HendrikThePendric committed Oct 14, 2024
1 parent 8adce12 commit 80ac2db
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/visualizations/config/adapters/dhis_highcharts/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const DASHBOARD_CHART = {
spacingLeft: 5,
}

const getEvents = () => ({
const getEvents = (visType) => ({
events: {
load: function () {
// Align legend icon with legend text
Expand All @@ -34,7 +34,7 @@ const getEvents = () => ({
})
}
})
renderCustomSVG.call(this)
renderCustomSVG.call(this, visType)
},
},
})
Expand All @@ -46,7 +46,7 @@ export default function (layout, el, extraOptions, series) {
{ renderTo: el || layout.el },
DEFAULT_CHART,
extraOptions.dashboard ? DASHBOARD_CHART : undefined,
getEvents(),
getEvents(layout.type),
layout.type === VIS_TYPE_SINGLE_VALUE
? {
backgroundColor: getSingleValueBackgroundColor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { VIS_TYPE_SINGLE_VALUE } from '../../../../../modules/visTypes.js'
import { getSingleValueCustomSVGOptions } from './singleValue/index.js'
import { renderSingleValueSVG } from './singleValue/renderer/renderSingleValueSVG.js'

export function renderCustomSVG() {
const { visualizationType } = this.userOptions.customSVGOptions

switch (visualizationType) {
export function renderCustomSVG(visType) {
switch (visType) {
case VIS_TYPE_SINGLE_VALUE:
renderSingleValueSVG.call(this)
break
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { VIS_TYPE_SINGLE_VALUE } from '../../../../modules/visTypes.js'
import { renderSingleValueSVG } from './customSVGOptions/singleValue/renderer/renderSingleValueSVG.js'

export default function getExporting(layoutType) {
export default function getExporting(visType) {
const exporting = {
// disable exporting context menu
enabled: false,
}
switch (layoutType) {
switch (visType) {
case VIS_TYPE_SINGLE_VALUE:
return {
...exporting,
Expand Down

0 comments on commit 80ac2db

Please sign in to comment.