Skip to content

Commit

Permalink
[MIM-1765] Make title for axises on highchart required (#2515)
Browse files Browse the repository at this point in the history
* Make title for axises on highchart required

* Use offline exporting of highchart graphs

* revome global

* fix lowercase
  • Loading branch information
omsaggau authored Feb 12, 2024
1 parent fb55e64 commit 2bf1656
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
18 changes: 9 additions & 9 deletions src/main/resources/assets/js/app/highchart.es6
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Highcharts from 'highcharts'
import highchartsModuleData from 'highcharts/modules/data'
import highchartsModuleAccessibility from 'highcharts/modules/accessibility'
import highchartsModuleExporting from 'highcharts/modules/exporting'
import highchartsModuleOfflineExporting from 'highcharts/modules/offline-exporting'
import highchartsModuleNoDataToDisplay from 'highcharts/modules/no-data-to-display'
import highchartsModuleExportData from 'highcharts/modules/export-data'
import zipcelx from 'zipcelx/lib/legacy'
Expand All @@ -15,8 +16,9 @@ import accessibilityLang from '../highchart-lang.json'
// Initialize exporting module.
highchartsModuleData(Highcharts)
highchartsModuleAccessibility(Highcharts)
highchartsModuleExporting(Highcharts)
highchartsModuleNoDataToDisplay(Highcharts)
highchartsModuleExporting(Highcharts)
highchartsModuleOfflineExporting(Highcharts)
highchartsModuleExportData(Highcharts)

const EMPTY_CONFIG = {
Expand Down Expand Up @@ -156,9 +158,7 @@ export function init() {
event_label: label,
})

this.exportChart({
type: 'png',
})
this.exportChartLocal() //png is default
},
},
downloadJPEG: {
Expand All @@ -169,8 +169,8 @@ export function init() {
event_label: label,
})

this.exportChart({
type: 'jpeg',
this.exportChartLocal({
type: 'image/jpeg',
})
},
},
Expand All @@ -182,7 +182,7 @@ export function init() {
event_label: label,
})

this.exportChart({
this.exportChartLocal({
type: 'application/pdf',
})
},
Expand All @@ -195,8 +195,8 @@ export function init() {
event_label: label,
})

this.exportChart({
type: 'svg',
this.exportChartLocal({
type: 'image/svg+xml',
})
},
},
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/site/content-types/highchart/highchart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
<items>
<input name="xAxisTitle" type="TextLine">
<label>X-akse, tittel</label>
<occurrences minimum="1" maximum="1"/>
</input>
<input name="xAxisType" type="RadioButton">
<label>X-skala</label>
Expand Down Expand Up @@ -174,6 +175,7 @@
<items>
<input name="yAxisTitle" type="TextLine">
<label>Y-akse, tittel</label>
<occurrences minimum="1" maximum="1"/>
</input>
<input name="yAxisOffset" type="TextLine">
<label>Plassering av y-aksetittel</label>
Expand Down
15 changes: 7 additions & 8 deletions src/main/resources/site/parts/highchart/Highchart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import accessibilityLang from './../../../assets/js/highchart-lang.json'

if (typeof Highcharts === 'object') {
require('highcharts/modules/exporting')(Highcharts)
require('highcharts/modules/offline-exporting')(Highcharts)
require('highcharts/modules/export-data')(Highcharts)
require('highcharts/modules/data')(Highcharts)
require('highcharts/modules/no-data-to-display')(Highcharts)
Expand Down Expand Up @@ -160,9 +161,7 @@ function Highchart(props) {
addGtagForEvent(props.GA_TRACKING_ID, action, category, label)
}

this.exportChart({
type: 'png',
})
this.exportChartLocal() // png is default
},
},
downloadJPEG: {
Expand All @@ -173,8 +172,8 @@ function Highchart(props) {
addGtagForEvent(props.GA_TRACKING_ID, action, category, label)
}

this.exportChart({
type: 'jpeg',
this.exportChartLocal({
type: 'image/jpeg',
})
},
},
Expand All @@ -186,7 +185,7 @@ function Highchart(props) {
addGtagForEvent(props.GA_TRACKING_ID, action, category, label)
}

this.exportChart({
this.exportChartLocal({
type: 'application/pdf',
})
},
Expand All @@ -199,8 +198,8 @@ function Highchart(props) {
addGtagForEvent(props.GA_TRACKING_ID, action, category, label)
}

this.exportChart({
type: 'svg',
this.exportChartLocal({
type: 'image/svg+xml',
})
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import accessibilityLang from './../../../assets/js/highchart-lang.json'

if (typeof Highcharts === 'object') {
require('highcharts/modules/exporting')(Highcharts)
require('highcharts/modules/offline-exporting')(Highcharts)
require('highcharts/modules/export-data')(Highcharts)
require('highcharts/modules/data')(Highcharts)
require('highcharts/modules/no-data-to-display')(Highcharts)
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/site/parts/highmap/Highmap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import accessibilityLang from './../../../assets/js/highchart-lang.json'
if (typeof Highcharts === 'object') {
require('highcharts/modules/accessibility')(Highcharts)
require('highcharts/modules/exporting')(Highcharts)
require('highcharts/modules/offline-exporting')(Highcharts)
require('highcharts/modules/export-data')(Highcharts)
require('highcharts/modules/map')(Highcharts)
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/site/parts/nameSearch/nameSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { X } from 'react-feather'
import Highcharts from 'highcharts'
import HighchartsReact from 'highcharts-react-official'
import highchartsExporting from 'highcharts/modules/exporting'
import highchartsExportingOffline from 'highcharts/modules/offline-exporting'
import highchartsExportData from 'highcharts/modules/export-data'
import highchartsAccessibility from 'highcharts/modules/accessibility'
import { useMediaQuery } from 'react-responsive'
Expand All @@ -16,6 +17,7 @@ import accessibilityLang from './../../../assets/js/highchart-lang.json'

if (typeof window !== 'undefined' && typeof Highcharts === 'object') {
highchartsExporting(Highcharts)
highchartsExportingOffline(Highcharts)
highchartsExportData(Highcharts)
highchartsAccessibility(Highcharts)
}
Expand Down

0 comments on commit 2bf1656

Please sign in to comment.