Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apexcharts

Package Overview
Dependencies
Maintainers
1
Versions
223
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apexcharts - npm Package Compare versions

Comparing version 1.3.9 to 1.3.10

tests/e2e/snapshots/basic-area.png

2

package.json
{
"name": "apexcharts",
"description": "A JavaScript Chart Library",
"version": "1.3.9",
"version": "1.3.10",
"main": "dist/apexcharts.min.js",

@@ -6,0 +6,0 @@ "directories": {

@@ -131,3 +131,3 @@ import Graphics from '../Graphics'

fontSize: this.xaxisFontSize,
foreColor: this.xaxisForeColors[i],
foreColor: Array.isArray(this.xaxisForeColors) ? this.xaxisForeColors[i] : this.xaxisForeColors,
cssClass: 'apexcharts-xaxis-label ' + w.config.xaxis.labels.style.cssClass

@@ -404,15 +404,2 @@ })

if (xAxisTexts.length > 0) {
let firstLabelPos = xAxisTexts[0].getBBox()
let lastLabelPos = xAxisTexts[xAxisTexts.length - 1].getBBox()
if (firstLabelPos.x < -25) {
xAxisTexts[0].parentNode.removeChild(xAxisTexts[0])
}
if (lastLabelPos.x + lastLabelPos.width > w.globals.gridWidth) {
xAxisTexts[xAxisTexts.length - 1].parentNode.removeChild(xAxisTexts[xAxisTexts.length - 1])
}
}
if (yAxisTextsInversed.length > 0) {

@@ -419,0 +406,0 @@ // truncate y axis in bar chart

@@ -15,5 +15,7 @@ import Graphics from '../Graphics'

this.xaxisFontSize = this.w.config.xaxis.labels.style.fontSize
this.isBarHorizontal = !!((this.w.config.chart.type === 'bar' &&
this.w.config.plotOptions.bar.horizontal))
this.isBarHorizontal = !!(this.w.config.chart.type === 'bar' &&
this.w.config.plotOptions.bar.horizontal)
this.xaxisForeColors = this.w.config.xaxis.labels.style.colors
this.xAxisoffX = 0

@@ -167,2 +169,3 @@ if (this.w.config.xaxis.position === 'bottom') {

textAnchor: 'middle',
foreColor: Array.isArray(this.xaxisForeColors) ? this.xaxisForeColors[realIndex] : this.xaxisForeColors,
fontSize: this.xaxisFontSize,

@@ -169,0 +172,0 @@ cssClass: 'apexcharts-xaxis-label ' + w.config.xaxis.labels.style.cssClass

@@ -18,11 +18,54 @@ import Formatters from '../Formatters'

drawSeriesTexts ({ shared = true, ttItems, i = 0, j = null }) {
drawSeriesTexts ({
shared = true,
ttItems,
i = 0,
j = null
}) {
let w = this.w
const ttCtx = this.ttCtx
if (w.config.tooltip.custom !== undefined) {
this.handleCustomTooltip()
return
}
this.toggleActiveInactiveSeries(shared)
let values = this.getValuesToPrint({
i,
j
})
this.printLabels({
i,
j,
values,
ttItems,
shared
})
}
printLabels ({
i,
j,
values,
ttItems,
shared
}) {
const w = this.w
let val
const {
xVal,
zVal
} = values
let seriesName = ''
let pColor = w.globals.colors[i]
if ((j !== null && w.config.plotOptions.bar.distributed)) {
pColor = w.globals.colors[j]
}
let yLbFormatter = w.globals.yLabelFormatters[i]
let zVal = null
let zFormatter = w.globals.ttZFormatter
if (w.globals.ttValFormatter !== undefined) {

@@ -33,14 +76,134 @@ yLbFormatter = w.globals.ttValFormatter

if (!yLbFormatter) {
yLbFormatter = function (val) { return val }
yLbFormatter = function (label) {
return label
}
}
let xVal = ''
let val
for (let t = 0, inverset = w.globals.series.length - 1; t < w.globals.series.length; t++, inverset--) {
seriesName = w.config.tooltip.y.title.formatter(String(w.globals.seriesNames[i]), {
series: w.globals.series,
seriesIndex: i,
dataPointIndex: j,
w
})
let pColor = w.globals.colors[i]
if ((j !== null && w.config.plotOptions.bar.distributed)) {
pColor = w.globals.colors[j]
if (shared) {
const tIndex = w.config.tooltip.inverseOrder ? inverset : t
seriesName = w.config.tooltip.y.title.formatter(String(w.globals.seriesNames[tIndex]), {
series: w.globals.series,
seriesIndex: i,
dataPointIndex: j,
w
})
pColor = w.globals.colors[tIndex]
// for plot charts, not for pie/donuts
val = yLbFormatter(w.globals.series[tIndex][j], {
series: w.globals.series,
seriesIndex: i,
dataPointIndex: j,
w
})
// discard 0 values in BARS
if ((this.ttCtx.bars.length && w.config.chart.stacked && w.globals.series[tIndex][j] === 0) || typeof w.globals.series[tIndex][j] === 'undefined') {
val = undefined
}
} else {
val = yLbFormatter(w.globals.series[i][j], w)
}
// for pie / donuts
if (j === null) {
val = yLbFormatter(w.globals.series[i], w)
}
this.DOMHandling({
t,
ttItems,
values: {
val,
xVal,
zVal
},
seriesName,
shared,
pColor
})
}
}
DOMHandling ({
t,
ttItems,
values,
seriesName,
shared,
pColor
}) {
const w = this.w
const ttCtx = this.ttCtx
const {
val,
xVal,
zVal
} = values
let ttItemsChildren = null
ttItemsChildren = ttItems[t].children
if (w.config.tooltip.fillSeriesColor) {
// elTooltip.style.backgroundColor = pColor
ttItems[t].style.backgroundColor = pColor
ttItemsChildren[0].style.display = 'none'
}
if (ttCtx.showTooltipTitle) {
if (ttCtx.tooltipTitle === null) {
// get it once if null, and store it in class property
ttCtx.tooltipTitle = w.globals.dom.baseEl.querySelector(
'.apexcharts-tooltip-title'
)
}
ttCtx.tooltipTitle.innerHTML = xVal
}
if (ttCtx.blxaxisTooltip) {
ttCtx.xaxisTooltipText.innerHTML = xVal
}
const ttYLabel = ttItems[t].querySelector('.apexcharts-tooltip-text-label')
ttYLabel.innerHTML = seriesName ? seriesName + ': ' : ''
const ttYVal = ttItems[t].querySelector('.apexcharts-tooltip-text-value')
ttYVal.innerHTML = val
if (ttItemsChildren[0].classList.contains('apexcharts-tooltip-marker')) {
ttItemsChildren[0].style.backgroundColor = pColor
}
if (!w.config.tooltip.marker.show) {
ttItemsChildren[0].style.display = 'none'
}
if (zVal !== null) {
const ttZLabel = ttItems[t].querySelector('.apexcharts-tooltip-text-z-label')
ttZLabel.innerHTML = w.config.tooltip.z.title
const ttZVal = ttItems[t].querySelector('.apexcharts-tooltip-text-z-value')
ttZVal.innerHTML = zVal
}
if (shared) {
// hide when no Val
if (typeof val === 'undefined') {
ttItemsChildren[0].parentNode.style.display = 'none'
} else {
ttItemsChildren[0].parentNode.style.display = w.config.tooltip.items.display
}
}
}
toggleActiveInactiveSeries (shared) {
const w = this.w
if (shared) {
// make all tooltips active

@@ -62,5 +225,17 @@ this.tooltipUtil.toggleAllTooltipSeriesGroups('enable')

}
}
getValuesToPrint ({
i,
j
}) {
const w = this.w
const filteredSeriesX = this.tooltipUtil.filteredSeriesX()
let xVal = ''
let zVal = null
let val = null
let zFormatter = w.globals.ttZFormatter
if (j === null) {

@@ -84,3 +259,8 @@ val = w.globals.series[i]

} else {
xVal = w.globals.xLabelFormatter(bufferXVal, { series: w.globals.series, seriesIndex: i, dataPointIndex: j, w })
xVal = w.globals.xLabelFormatter(bufferXVal, {
series: w.globals.series,
seriesIndex: i,
dataPointIndex: j,
w
})
}

@@ -90,19 +270,10 @@

if (w.config.tooltip.x.formatter !== undefined) {
xVal = w.globals.ttKeyFormatter(bufferXVal, { series: w.globals.series, seriesIndex: i, dataPointIndex: j, w })
xVal = w.globals.ttKeyFormatter(bufferXVal, {
series: w.globals.series,
seriesIndex: i,
dataPointIndex: j,
w
})
}
if (ttCtx.showTooltipTitle) {
if (ttCtx.tooltipTitle === null) {
// get it once if null, and store it in class property
ttCtx.tooltipTitle = w.globals.dom.baseEl.querySelector(
'.apexcharts-tooltip-title'
)
}
ttCtx.tooltipTitle.innerHTML = xVal
}
if (ttCtx.blxaxisTooltip) {
ttCtx.xaxisTooltipText.innerHTML = xVal
}
if (w.globals.seriesZ.length > 0 && w.globals.seriesZ[0].length > 0) {

@@ -112,72 +283,24 @@ zVal = zFormatter(w.globals.seriesZ[i][j], w)

for (let t = 0, inverset = w.globals.series.length - 1; t < w.globals.series.length; t++, inverset--) {
let seriesName = w.config.tooltip.y.title.formatter(String(w.globals.seriesNames[i]), { series: w.globals.series, seriesIndex: i, dataPointIndex: j, w })
if (shared) {
const tIndex = w.config.tooltip.inverseOrder ? inverset : t
seriesName = w.config.tooltip.y.title.formatter(String(w.globals.seriesNames[tIndex]), { series: w.globals.series, seriesIndex: i, dataPointIndex: j, w })
pColor = w.globals.colors[tIndex]
// for plot charts, not for pie/donuts
val = yLbFormatter(w.globals.series[tIndex][j], { series: w.globals.series, seriesIndex: i, dataPointIndex: j, w })
// discard 0 values in BARS
if ((ttCtx.bars.length && w.config.chart.stacked && w.globals.series[tIndex][j] === 0) || typeof w.globals.series[tIndex][j] === 'undefined') {
val = undefined
}
}
// for pie/donuts
if (j !== null && !shared) {
val = yLbFormatter(w.globals.series[i][j], w)
}
// override everything with a custom html tooltip and replace it
if (w.config.tooltip.custom !== undefined) {
ttCtx.tooltip.innerHTML = ''
ttCtx.tooltip.innerHTML = w.config.tooltip.custom({ series: w.globals.series, seriesIndex: i, dataPointIndex: j, w })
return
}
let ttItemsChildren = null
ttItemsChildren = ttItems[t].children
if (w.config.tooltip.fillSeriesColor) {
// elTooltip.style.backgroundColor = pColor
ttItems[t].style.backgroundColor = pColor
ttItemsChildren[0].style.display = 'none'
}
const ttYLabel = ttItems[t].querySelector('.apexcharts-tooltip-text-label')
ttYLabel.innerHTML = seriesName ? seriesName + ': ' : ''
const ttYVal = ttItems[t].querySelector('.apexcharts-tooltip-text-value')
ttYVal.innerHTML = val
if (ttItemsChildren[0].classList.contains('apexcharts-tooltip-marker')) {
ttItemsChildren[0].style.backgroundColor = pColor
}
if (!w.config.tooltip.marker.show) {
ttItemsChildren[0].style.display = 'none'
}
if (zVal !== null) {
const ttZLabel = ttItems[t].querySelector('.apexcharts-tooltip-text-z-label')
ttZLabel.innerHTML = w.config.tooltip.z.title
const ttZVal = ttItems[t].querySelector('.apexcharts-tooltip-text-z-value')
ttZVal.innerHTML = zVal
}
if (shared) {
// hide when no Val
if (typeof val === 'undefined') {
ttItemsChildren[0].parentNode.style.display = 'none'
} else {
ttItemsChildren[0].parentNode.style.display = w.config.tooltip.items.display
}
}
return {
val,
xVal,
zVal
}
}
handleCustomTooltip ({
i,
j
}) {
const w = this.w
// override everything with a custom html tooltip and replace it
this.ttCtx.tooltip.innerHTML = ''
this.ttCtx.tooltip.innerHTML = w.config.tooltip.custom({
series: w.globals.series,
seriesIndex: i,
dataPointIndex: j,
w
})
}
}
module.exports = Labels

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc