Support » Plugin: amCharts: Charts and Maps » How to not show the Y-axis values.

  • Resolved Sevario

    (@sevario)


    Hello, I am using the latest version of amCharts.
    I have a javascript chart setup with an oracle database.
    I need to have the chart not show the Y axis values as it can be used to reverse engineer the formulas used to calculate this information.
    I have found online that there is a valueAxis.labelsEnabled = false; you can use, but I can’t find out where to place that? I am currently looking at the chart editing screen of wordpress where I can see a resources, HTML and Javascript section.
    Does anyone know where to place this?

    https://wordpress.org/plugins/amcharts-charts-and-maps/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author martynasma

    (@martynasma)

    Hi there,

    You probably have the chart config in JSON format, i.e.:

    AmCharts.makeChart("%CHART%", {
      "type": "serial",
      // ... rest of the config skipped
    });

    Look up the “valueAxes” part and add the “labelsEnabled” there. I.e.:

    AmCharts.makeChart("%CHART%", {
      "type": "serial",
      "valueAxes": [{
        "labelsEnabled": false
      }],
      // ... rest of the config skipped
    });

    If you don’t have that section in your config, you can add it exactly like the above.

    That being said, you must understand, that disabling labels does mean that your data will be hidden in some way. It will still need to be loaded on client-side and will therefore be accessible for anyone being able to view the chart.

    I hope this helps.

    Thread Starter Sevario

    (@sevario)

    Hello martynasma,

    Thank you for your reply, but I still can’t find any of the things you posted.
    This is what my Javascript part looks like:

    var chart;

    // create chart

    AmCharts.ready(function() {

    // load the data

    var chartData = AmCharts.loadJSON(‘http://localhost/QMS/wordpress/ftdata.php’);

    // SERIAL CHART

    chart = new AmCharts.AmSerialChart();

    chart.dataProvider = chartData;

    chart.categoryField = “WBD_DATUM”;

    chart.dataDateFormat = “DD-MM-YYYY”;

    // GRAPHS

    var graph1 = new AmCharts.AmGraph();

    graph1.valueField = “WBD_BEREKENDE_WAARDE”;

    graph1.bulletBorderThickness = 2;

    graph1.lineThickness = 2;

    graph1.lineAlpha = 0.5;

    graph1.type = “line”;

    graph1.columnWidth = “0”;

    graph1.lineColor = “#4b1966”;

    graph1.balloonText = “”;

    graph1.gridColor = “#4b1966”;

    chart.addGraph(graph1);

    chart.valueAxis.labelsEnabled = false;

    // CATEGORY AXIS

    chart.categoryAxis.parseDates = false;

    //chart.categoryAxis.ignoreAxisWidth = false;

    chart.chartScrollbar = new AmCharts.ChartScrollbar();

    chart.chartCursor = new AmCharts.ChartCursor();

    chart.mouseWheelZoomEnabled = true;

    chart.mouseWheelScrollEnabled = true;

    // WRITE

    chart.write(“chartdiv”);

    });

    AmCharts.loadJSON = function(url) {

    // create the request

    if (window.XMLHttpRequest) {

    // IE7+, Firefox, Chrome, Opera, Safari

    var request = new XMLHttpRequest();

    } else {

    // code for IE6, IE5

    var request = new ActiveXObject(‘Microsoft.XMLHTTP’);;

    }

    // load it

    // the last “false” parameter ensures that our code will wait before the

    // data is loaded

    request.open(‘GET’, url, false);

    request.send();

    // parse adn return the output

    return eval(request.responseText);

    };

    Plugin Author martynasma

    (@martynasma)

    Thanks for the code. Take this line:

    chart.valueAxis.labelsEnabled = false;

    Which will not work and should generate a JavaScript error. And replace it with this:

    var valueAxis = new AmCharts.ValueAxis();
    valueAxis.labelsEnabled = false;
    chart.addValueAxis(valueAxis);
    Thread Starter Sevario

    (@sevario)

    Thank you very much martynasma, it is working perfectly now 🙂

    Plugin Author martynasma

    (@martynasma)

    Great! You’re most welcome.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to not show the Y-axis values.’ is closed to new replies.