apexcharts
Advanced tools
Comparing version 1.5.5 to 1.5.6
{ | ||
"name": "apexcharts", | ||
"description": "A JavaScript Chart Library", | ||
"version": "1.5.5", | ||
"version": "1.5.6", | ||
"main": "dist/apexcharts.min.js", | ||
@@ -6,0 +6,0 @@ "directories": { |
@@ -475,8 +475,10 @@ import Annotations from './modules/Annotations' | ||
w.config.xaxis.min = w.globals.initialConfig.xaxis.min | ||
w.config.xaxis.max = w.globals.initialConfig.xaxis.max | ||
w.config.xaxis.min = w.globals.lastXAxis.min | ||
w.config.xaxis.max = w.globals.lastXAxis.max | ||
w.config.yaxis.map((yaxe, index) => { | ||
w.config.yaxis[index].min = w.globals.initialYAxis[index].min | ||
w.config.yaxis[index].max = w.globals.initialYAxis[index].max | ||
if (typeof w.globals.lastYAxis[index] !== 'undefined') { | ||
yaxe.min = w.globals.lastYAxis[index].min | ||
yaxe.max = w.globals.lastYAxis[index].max | ||
} | ||
}) | ||
@@ -483,0 +485,0 @@ } |
@@ -710,3 +710,2 @@ import Fill from '../modules/Fill' | ||
const isSeriesNotCollapsed = w.globals.collapsedSeriesIndices.includes(i) | ||
console.log(isSeriesNotCollapsed) | ||
@@ -713,0 +712,0 @@ if (dataLabelsConfig.enabled && !isSeriesNotCollapsed) { |
@@ -60,4 +60,2 @@ import Graphics from '../Graphics' | ||
if (w.globals.noData) return elXaxis | ||
for (let i = 0; i < this.xaxisLabels.length; i++) { | ||
@@ -126,3 +124,3 @@ labels.push(this.xaxisLabels[i]) | ||
label = label.toString() | ||
if (label.indexOf('NaN') >= 0 || label.indexOf('undefined') >= 0) { | ||
if (label.indexOf('NaN') >= 0 || label.indexOf('undefined') >= 0 || label.indexOf('Invalid') >= 0) { | ||
label = '' | ||
@@ -413,15 +411,2 @@ } | ||
// the below code removes any labels which doesn't fits in the grid area. | ||
// but many users didn't liked it - so commented out, will remove it | ||
// if (xAxisTexts.length > 0) { | ||
// let firstLabelPos = xAxisTexts[0].getBBox() | ||
// let lastLabelPos = xAxisTexts[xAxisTexts.length - 1].getBBox() | ||
// if (xAxisTexts[0].getAttribute('x') < -10) { | ||
// xAxisTexts[0].parentNode.removeChild(xAxisTexts[0]) | ||
// } | ||
// if (lastLabelPos.x + lastLabelPos.width > w.globals.gridWidth + 15) { | ||
// xAxisTexts[xAxisTexts.length - 1].parentNode.removeChild(xAxisTexts[xAxisTexts.length - 1]) | ||
// } | ||
// } | ||
if (yAxisTextsInversed.length > 0) { | ||
@@ -428,0 +413,0 @@ // truncate rotated y axis in bar chart (x axis) |
@@ -467,3 +467,3 @@ import Bar from '../charts/Bar' | ||
} | ||
} else if (isXDate) { | ||
} else { | ||
if (cnf.xaxis.type === 'datetime') { | ||
@@ -474,5 +474,2 @@ this.twoDSeriesX.push(dt.parseDate(ser[i].data[j].x.toString())) | ||
} | ||
} else { | ||
this.fallbackToCategory = true | ||
this.twoDSeriesX.push(parseInt(ser[i].data[j].x)) | ||
} | ||
@@ -479,0 +476,0 @@ } else { |
@@ -25,3 +25,6 @@ import Utils from '../utils/Utils' | ||
niceScale (yMin, yMax, ticks = 10) { | ||
if ((yMin === Number.MIN_VALUE && yMax === 0) || (!Utils.isNumber(yMin) && !Utils.isNumber(yMax))) { | ||
if ( | ||
(yMin === Number.MIN_VALUE && yMax === 0) || | ||
(!Utils.isNumber(yMin) && !Utils.isNumber(yMax)) | ||
) { | ||
// when all values are 0 | ||
@@ -35,2 +38,14 @@ yMin = 0 | ||
if (yMin > yMax) { | ||
// if somehow due to some wrong config, user sent max less than min, | ||
// adjust the min/max again | ||
yMin = yMax - 0.1 | ||
} else if (yMin === yMax) { | ||
// If yMin and yMax are identical, then | ||
// adjust the yMin and yMax values to actually | ||
// make a graph. Also avoids division by zero errors. | ||
yMin = yMin - 10 // some small value | ||
yMax = yMax + 10 // some small value | ||
} | ||
// Calculate Min amd Max graphical labels and graph | ||
@@ -45,9 +60,3 @@ // increments. The number of ticks defaults to | ||
let result = [] | ||
// If yMin and yMax are identical, then | ||
// adjust the yMin and yMax values to actually | ||
// make a graph. Also avoids division by zero errors. | ||
if (yMin === yMax) { | ||
yMin = yMin - 10 // some small value | ||
yMax = yMax + 10 // some small value | ||
} | ||
// Determine Range | ||
@@ -54,0 +63,0 @@ let range = yMax - yMin |
@@ -35,3 +35,4 @@ import Utils from './../../utils/Utils' | ||
initialConfig: null, // we will store the first config user has set to go back when user finishes interactions like zooming and come out of it | ||
initialYAxis: [], | ||
lastXAxis: [], | ||
lastYAxis: [], | ||
series: [], // the MAIN series array (y values) | ||
@@ -161,5 +162,6 @@ seriesPercent: [], // the percentage values of the given series | ||
globals.initialSeries = JSON.parse(JSON.stringify(globals.initialConfig.series)) | ||
globals.initialYAxis = JSON.parse(JSON.stringify(globals.initialConfig.yaxis)) | ||
globals.lastXAxis = JSON.parse(JSON.stringify(globals.initialConfig.xaxis)) | ||
globals.lastYAxis = JSON.parse(JSON.stringify(globals.initialConfig.yaxis)) | ||
return globals | ||
} | ||
} |
@@ -443,3 +443,3 @@ import DateTime from '../utils/DateTime' | ||
// push the first tick in the array | ||
this.timeScaleArray.push({ position: firstTickPosition, value: firstTickValue, unit, day: date, year: currentYear, month: this.monthMod(month) }) | ||
this.timeScaleArray.push({ position: firstTickPosition, value: firstTickValue, unit, day: date, hour, year: currentYear, month: this.monthMod(month) }) | ||
@@ -463,5 +463,5 @@ let pos = firstTickPosition | ||
let year = currentYear + Math.floor(month / 12) + (yrCounter) | ||
pos = (60 * minutesWidthOnXAxis) + pos | ||
pos = (hour === 0 && i === 0) ? (remainingMins * minutesWidthOnXAxis) : (60 * minutesWidthOnXAxis) + pos | ||
let val = (hour === 0) ? date : hour | ||
this.timeScaleArray.push({ position: pos, value: val, unit, day: date, year, month: this.monthMod(month) }) | ||
this.timeScaleArray.push({ position: pos, value: val, unit, hour, day: date, year, month: this.monthMod(month) }) | ||
@@ -468,0 +468,0 @@ hour++ |
@@ -281,4 +281,2 @@ import Graphics from './Graphics' | ||
let me = this | ||
let yaxis = w.config.yaxis | ||
let xaxis = w.config.xaxis | ||
w.globals.zoomed = false | ||
@@ -288,8 +286,3 @@ | ||
w.config.yaxis.map((yaxe, index) => { | ||
yaxis[index].min = w.globals.initialYAxis[index].min | ||
yaxis[index].max = w.globals.initialYAxis[index].max | ||
}) | ||
xaxis.min = w.globals.initialConfig.xaxis.min | ||
xaxis.max = w.globals.initialConfig.xaxis.max | ||
me.ctx.revertDefaultAxisMinMax() | ||
@@ -296,0 +289,0 @@ me.ctx.updateSeriesInternal(w.globals.initialSeries, true) |
@@ -118,3 +118,3 @@ import Formatters from '../Formatters' | ||
let yLbFormatter = w.globals.yLabelFormatters[i] | ||
let yLbTitleFormatter = function (val) { return val } | ||
let yLbTitleFormatter | ||
@@ -127,4 +127,8 @@ if (w.globals.ttVal !== undefined) { | ||
yLbFormatter = w.globals.ttVal.formatter | ||
yLbTitleFormatter = w.globals.ttVal.title.formatter | ||
if (typeof w.globals.ttVal.title.formatter === 'function') { | ||
yLbTitleFormatter = w.globals.ttVal.title.formatter | ||
} | ||
} | ||
} else { | ||
yLbTitleFormatter = w.config.tooltip.y.title.formatter | ||
} | ||
@@ -131,0 +135,0 @@ |
@@ -438,2 +438,7 @@ import Graphics from './Graphics' | ||
let yaxis = Utils.clone(w.config.yaxis) | ||
// before zooming in/out, store the last yaxis and xaxis range, so that when user hits the RESET button, we get the original range | ||
w.globals.lastYAxis = Utils.clone(w.config.yaxis) | ||
w.globals.lastXAxis = Utils.clone(w.config.xaxis) | ||
let xaxis = { | ||
@@ -451,3 +456,3 @@ min: xLowestValue, | ||
let beforeZoomRange = this.getBeforeZoomRange(xaxis, yaxis) | ||
let beforeZoomRange = this.toolbar.getBeforeZoomRange(xaxis, yaxis) | ||
@@ -454,0 +459,0 @@ if (beforeZoomRange !== null) { |
@@ -24,9 +24,15 @@ import TimeScale from '../modules/TimeScale' | ||
parseDate (date) { | ||
const parsed = Date.parse(date) | ||
getUTCTimeStamp (dateStr) { | ||
return new Date(new Date(dateStr).toUTCString().substr(0, 25)).getTime() | ||
} | ||
parseDate (dateStr) { | ||
const parsed = Date.parse(dateStr) | ||
if (!isNaN(parsed)) { | ||
return parsed | ||
return this.getUTCTimeStamp(dateStr) | ||
} | ||
return Date.parse(date.replace(/-/g, '/').replace(/[a-z]+/gi, ' ')) | ||
let output = Date.parse(dateStr.replace(/-/g, '/').replace(/[a-z]+/gi, ' ')) | ||
output = this.getUTCTimeStamp(output) | ||
return output | ||
} | ||
@@ -33,0 +39,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2315382
118
40249