Skip to content

Commit 90cf3e9

Browse files
chore: remove offline export related code (#1729)
* chore: update yarn.lock * chore: remove offline export demo from storybook * chore: remove pdf export specific render code * chore: remove offline pdf export bugfix plugins * chore: remove offline export module
1 parent 0e7b8f3 commit 90cf3e9

9 files changed

Lines changed: 25 additions & 618 deletions

File tree

.storybook/preview-head.html

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/__demo__/SingleValue.stories.js

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useMemo, useRef, useEffect, useCallback } from 'react'
1+
import React, { useState, useMemo, useRef, useEffect } from 'react'
22
import { createVisualization } from '../index.js'
33
const constainerStyleBase = {
44
width: 800,
@@ -636,7 +636,6 @@ export const Default = () => {
636636
const [dashboard, setDashboard] = useState(false)
637637
const [showIcon, setShowIcon] = useState(true)
638638
const [indicatorType, setIndicatorType] = useState('plain')
639-
const [exportAsPdf, setExportAsPdf] = useState(true)
640639
const [width, setWidth] = useState(constainerStyleBase.width)
641640
const [height, setHeight] = useState(constainerStyleBase.height)
642641
const containerStyle = useMemo(
@@ -682,39 +681,6 @@ export const Default = () => {
682681
})
683682
}
684683
}, [containerStyle, dashboard, showIcon, indicatorType])
685-
const downloadOffline = useCallback(() => {
686-
if (newChartRef.current) {
687-
const currentBackgroundColor =
688-
newChartRef.current.userOptions.chart.backgroundColor
689-
690-
newChartRef.current.update({
691-
exporting: {
692-
chartOptions: {
693-
isPdfExport: exportAsPdf,
694-
},
695-
},
696-
})
697-
newChartRef.current.exportChartLocal(
698-
{
699-
sourceHeight: 768,
700-
sourceWidth: 1024,
701-
scale: 1,
702-
fallbackToExportServer: false,
703-
filename: 'testOfflineDownload',
704-
showExportInProgress: true,
705-
type: exportAsPdf ? 'application/pdf' : 'image/png',
706-
},
707-
{
708-
chart: {
709-
backgroundColor:
710-
currentBackgroundColor === 'transparent'
711-
? '#ffffff'
712-
: currentBackgroundColor,
713-
},
714-
}
715-
)
716-
}
717-
}, [exportAsPdf])
718684

719685
return (
720686
<>
@@ -782,15 +748,6 @@ export const Default = () => {
782748
})}
783749
</select>
784750
</label>
785-
<label>
786-
<input
787-
checked={exportAsPdf}
788-
onChange={() => setExportAsPdf(!exportAsPdf)}
789-
type="checkbox"
790-
/>
791-
&nbsp;Export as PDF
792-
</label>
793-
<button onClick={downloadOffline}>Download offline</button>
794751
</div>
795752
<div style={{ display: 'flex', gap: 12 }}>
796753
<div style={containerStyle}>

src/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { DynamicStyles } from './styles.js'
77
export default function loadSingleValueSVG() {
88
const { formattedValue, icon, subText, fontColor } =
99
this.userOptions.customSVGOptions
10-
const dynamicStyles = new DynamicStyles(this.userOptions?.isPdfExport)
10+
const dynamicStyles = new DynamicStyles()
1111
const valueElement = this.renderer
1212
.text(formattedValue)
1313
.attr('data-test', 'visualization-primary-value')

src/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/styles.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ const spacings = [
2828
export const MIN_SIDE_WHITESPACE = 4
2929

3030
export class DynamicStyles {
31-
constructor(isPdfExport) {
31+
constructor() {
3232
this.currentIndex = 0
33-
this.isPdfExport = isPdfExport
3433
}
3534
getStyle() {
3635
return {
3736
value: {
3837
...valueStyles[this.currentIndex],
39-
'font-weight': this.isPdfExport ? 'normal' : '300',
38+
'font-weight': '300',
4039
},
4140
subText: subTextStyles[this.currentIndex],
4241
spacing: spacings[this.currentIndex],

src/visualizations/config/generators/highcharts/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,16 @@ import HM from 'highcharts/highcharts-more'
33
import HB from 'highcharts/modules/boost'
44
import HE from 'highcharts/modules/exporting'
55
import HNDTD from 'highcharts/modules/no-data-to-display'
6-
import HOE from 'highcharts/modules/offline-exporting'
76
import HPF from 'highcharts/modules/pattern-fill'
87
import HSG from 'highcharts/modules/solid-gauge'
9-
import PEBFP from './pdfExportBugFixPlugin/index.js'
108

119
// apply
1210
HM(H)
1311
HSG(H)
1412
HNDTD(H)
1513
HE(H)
16-
HOE(H)
1714
HPF(H)
1815
HB(H)
19-
PEBFP(H)
2016

2117
/* Whitelist some additional SVG attributes here. Without this,
2218
* the PDF export for the SingleValue visualization breaks. */

src/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/nonASCIIFont.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)