Skip to content

Commit

Permalink
Styling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MHewison committed Apr 19, 2023
1 parent 832cbef commit 4064d80
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/modules/Exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ class Exports {
}

exportToCSV({
series,
fileName,
columnDelimiter = ',',
lineDelimiter = '\n'
}) {
series,
fileName,
columnDelimiter = ',',
lineDelimiter = '\n'
}) {
const w = this.w

if (!series) series = w.config.series
Expand Down Expand Up @@ -296,8 +296,8 @@ class Exports {
isTimeStamp(cat)
? w.config.chart.toolbar.export.csv.dateFormatter(cat)
: Utils.isNumber(cat)
? cat
: cat.split(columnDelimiter).join('')
? cat
: cat.split(columnDelimiter).join('')
)

for (let ci = 0; ci < w.globals.series.length; ci++) {
Expand Down Expand Up @@ -394,7 +394,7 @@ class Exports {

this.triggerDownload(
'data:text/csv; charset=utf-8,' +
encodeURIComponent(universalBOM + result),
encodeURIComponent(universalBOM + result),
fileName ? fileName : w.config.chart.toolbar.export.csv.filename,
'.csv'
)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/download-csv.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe('Export Csv', () => {
)
})
it('export csv from simple line chart with first series collapsed should call triggerDownload with csv encoded file data', () => {
const series = [{name: 'series 1', data: [0,1]},{name: 'series 2', data: [1,2]}]
const series = [{name: 'series 1', data: [0,1]},{name: 'series 2', data: [1,2]}]
const csvData = "category,series 1,series 2\n" +
"1,,1\n" +
"2,,2"
Expand Down

0 comments on commit 4064d80

Please sign in to comment.