Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/modules/Exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ class Exports {
}
}

// let the caller know the current category is null. this can happen for example
// when dealing with line charts having inconsistent time series data
if (cat === null)
return 'nullvalue'

if (Array.isArray(cat)) {
cat = cat.join(' ')
}
Expand All @@ -282,6 +287,11 @@ class Exports {
columns = []

let cat = getCat(i)

// current category is null, let's move on to the next one
if (cat === 'nullvalue')
continue

if (!cat) {
if (dataFormat.isFormatXY()) {
cat = series[sI].data[i].x
Expand All @@ -296,8 +306,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 @@ -380,8 +390,8 @@ class Exports {
isTimeStamp(cat) && w.config.xaxis.type === 'datetime'
? w.config.chart.toolbar.export.csv.dateFormatter(cat)
: Utils.isNumber(cat)
? cat
: cat.split(columnDelimiter).join(''),
? cat
: cat.split(columnDelimiter).join(''),
data[cat].join(columnDelimiter),
])
})
Expand Down Expand Up @@ -446,7 +456,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