Chart.js: Some labels on axis's are missing

Created on 18 Jun 2016  路  8Comments  路  Source: chartjs/Chart.js

I'll draw a chart with on the X-axis names of cities. The problem is when I'll draw the chart. The values of the even names are missing _(see the yellow marks on the image below)_.

image

For this chart I wouldn't have that. Is this a bug or have I miss anything in my code?

Most helpful comment

I've found it in the documentation:

scales: {
    xAxes: [{
        stacked: false,
        beginAtZero: true,
        scaleLabel: {
            labelString: 'Month'
        },
        ticks: {
            stepSize: 1,
            min: 0,
            autoSkip: false
        }
    }]
}

All 8 comments

The auto skip feature is probably hiding them. There is a setting to turn it off, but i don't recall the exact name

I've found it in the documentation:

scales: {
    xAxes: [{
        stacked: false,
        beginAtZero: true,
        scaleLabel: {
            labelString: 'Month'
        },
        ticks: {
            stepSize: 1,
            min: 0,
            autoSkip: false
        }
    }]
}

In case the previous comment was not clear here is the documentation link:
http://www.chartjs.org/docs/latest/axes/cartesian/#tick-configuration
autoSkip property.

not working for me, even if setting autoskip:false (tried in the ticks options, in the data array...)

This works for me (as an example):
chart.scales["x-axis-0"].options.ticks.autoSkip = false;
chart.scales["x-axis-0"].options.ticks.stepSize = 1;

Note that it's not chart.scales["x-axis-0"].ticks as that contains the array of labels

I've tried this, but it doesn't solve the problem for me. I get a second set of labels on the xaxis that contains all the labels, however they don't align with the data. The first level of labels with the skipping still exists:

screen shot 2018-06-28 at 4 18 35 pm

In case this issue wasn't solve yet. Keep that on mind that labels property is inside of data property

something like this.

 new Chart($("#element_id"), {
        type: 'line',
        data: {
            datasets: [
                {
                    label: 'A',
                    backgroundColor: "rgba(255, 99, 132, 0.5)",
                    borderColor: "rgb(255, 99, 132)",
                    fill: false,
                    data: [2.3, 1, 2.3, 4, 3.1],
                },
                {
                    label: 'B',
                    backgroundColor: "rgba(54, 162, 235, 0.5)",
                    borderColor: "rgb(54, 162, 235)",
                    fill: false,
                    data: [1.3, 1, 1.3, 3, 3.1]
                },
                {
                    label: 'C',
                    backgroundColor: "#95CB91",
                    borderColor: "#3C8C38",
                    fill: false,
                    data: [1,2, 4, 2.2, 1.8]
                }
            ],
            labels: ["L1", "L2", "L3", "L4", "L5"],
        },

image
worked for me (https://github.com/jtblin/angular-chart.js/issues/423)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joebirkin picture joebirkin  路  3Comments

Woogles picture Woogles  路  3Comments

HeinPauwelyn picture HeinPauwelyn  路  3Comments

akashrajkn picture akashrajkn  路  3Comments

SylarRuby picture SylarRuby  路  3Comments