I am creating a chart project with apexChart. My aim is to hide xaxis labels which has odd index of the xaxis elements. with some hours of researches in the net, I can not still achieve it. Could anyone help me please? [![enter image description here][1]][1] [1]: https://i.sstatic.net/ZJlqW.png
This is my snipped code:
<div id="chart"></div>
<script src="apexcharts.js"></script>
<script>
var typeStr = 'column';
var options = {
series: [
{
name: 'acts number',
type: typeStr,
data: [0, 0, 0, 8, 10, 45.6, 0, 0, 0, 0, 0, 0]
},
{
name: 'cost',
type: typeStr,
data: [0.0, 0.0, 0.0, 25.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
}],
chart: {
height: 350,
type: 'line',
stacked: false,
toolbar: {
show: false
},
zoom: {
enabled: false
}
},
stroke: {
width: [2, 2, 2],
curve: 'straight'
},
legend: {
show: false
},
colors: ['#10baee', '#297694'],
dataLabels: {
enabled: false,
enabledOnSeries: [1]
},
xaxis: {
categories: ['07 fevr.','08 fevr.','09 fevr.','10 fevr.','11 fevr.','12 fevr.','13 fevr.', '14 fevr.','15 fevr.','16 fevr.','17 fevr.','18 fevr.'],
tickPlacement: 'on'
},
yaxis: [
{
seriesName: 'acts',
axisTicks: {
show: true,
},
axisBorder: {
show: true,
color: '#10baee'
},
labels: {
style: {
color: '#10baee',
},
formatter: (value) => { return value }
},
title: {
text: "Views",
style: {
color: '#10baee',
}
},
},
{
seriesName: 'cost',
opposite: true,
axisTicks: {
show: true,
},
axisBorder: {
show: true,
color: '#297694'
},
labels: {
style: {
color: '#297694',
},
formatter: function (value) {
return value.toFixed(2) + " \u20ac";
},
},
title: {
text: "Acts price",
style: {
color: '#297694',
}
}
},
]
};
var chartH = new ApexCharts(document.querySelector("#chart"), options);
chartH.render();
series
do you use? Whatoptions
did you set? Probably I could then guide you to use thefilter
function from thexaxis
object (as exemplified here: ApexChart-Formatter – Magus