Home Forums Chart Support How to remove commas from labels

How to remove commas from labels

Viewing 2 posts - 1 through 2 (of 2 total)
  • #60752

    I am trying to make a very generic bar chart where the width of the bar depicts a start year and an end year of a number school levies and bonds. The problem is the numbers keep defaulting to a regular number, and thus a four digit year is appearing with a comma between the left most digit and the next three. When I try to use formatting to force #### or YYYY those actual letters appear in the label (both under the graph an inside of it).

    How can I make these look like years without a comma?

    `window.onload = function () {

    var chart3 = new CanvasJS.Chart(“chartContainer3”, {
    animationEnabled: true,
    exportEnabled: true,
    title: {
    text: “Levies & Expiration Dates”
    },
    axisX: {
    title: “Levy Name”,
    ValueFormatString: “####”
    },
    axisY: {
    title: “Years In Force”,
    scaleBreaks: {
    type: “wavy”,
    customBreaks: [{
    startValue: 2035,
    endValue: 2095
    }
    ]},
    ValueFormatString: “####”
    },
    data: [{
    type: “rangeBar”,
    showInLegend: true,
    indexLabel: “{y[#index]}”,
    yalueFormatString: “YYYY”,
    legendText: “Levies with a 2100 end date never expire”,
    toolTipContent: “<b>{label}</b>: {y[0]} to {y[1]}”,
    dataPoints: [
    { x: 10, y:[1978, 2100], label: “1978 Levy” },
    { x: 20, y:[1984, 2100], label: “1984 Levy” },
    { x: 30, y:[1988, 2100], label: “1988 Levy” },
    { x: 40, y:[1993, 2100], label: “1993 Levy” },
    { x: 50, y:[2000, 2030], label: “Bond Renovations” },
    { x: 60, y:[2004, 2100], label: “2004 Levy” },
    { x: 70, y:[2008, 2030], label: “Bond Stadium” },
    { x: 80, y:[2011, 2100], label: “2011 Levy ” },
    { x: 90, y:[2019, 2100], label: “2019 Levy” },
    { x: 100, y:[2026, 2100], label: “Issue 10” }
    ]
    }]
    });
    chart3.render();

    #60762

    @jgarvas,

    It seems like the issue you’re facing with the ValueFormatString not working is due to the case sensitivity. The correct property name is valueFormatString in camelCase, not ValueFormatString. Please try updating it to valueFormatString and check if that resolves the problem. Please take a look at this JSFiddle for working code. If the issue persists, kindly create a JSFiddle reproducing the issue & share it with us so that we can look into the code/chart-options being used, understand the scenario better and help you out.

    Range Bar Chart with Scalebreaks


    Vishwas R
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.