1

I have a line graph using Chartjs 2.9.3 that I'm trying to display without markers. I just want the line represented.

Maybe I'm just putting the markerSize parameter in the wrong place, or maybe it's been updated to some other term. My code below and the chart sample image.

$(document).ready(function () {
    showGraph();
});


function showGraph()
{
    {
        $.post("data.php",
        function (data)
        {
            console.log(data);
            var logdate = [];
            var temperature = [];
            var humidity = [];
            var heat = [];

            for (var i in data) {
                logdate.push(data[i].logged);
                temperature.push(data[i].temperature);
                humidity.push(data[i].humidity);
                heat.push(data[i].heater);
            }

            var chartdata = {
                labels: logdate,
                datasets: [
                    {
                        label: 'Temperature', 
                        fill: false,
                        markerSize: 0,
                        lineTension: 0,
                        lineThickness: 1,
                        borderWidth: 1 ,
                        backgroundColor: '#ff0000',
                        borderColor: '#ff0000',
                        hoverBackgroundColor: '#CCCCCC',
                        hoverBorderColor: '#666666',
                        data: temperature
                    },
                    {
                        label: 'Humidity',                  
                        fill: false,
                        markerSize: 0,
                        lineTension: 0,
                        lineThickness: 1,
                        borderWidth: 0 ,
                        backgroundColor: '#00ff00',
                        borderColor: '#00ff00',
                        hoverBackgroundColor: '#CCCCCC',
                        hoverBorderColor: '#666666',
                        data: humidity
                    },
                    {
                        label: 'Heat',
                        fill: false,
                        markerSize: 0,                      
                        lineTension: 0,
                        lineThickness: 0,
                        borderWidth: 0 ,
                        backgroundColor: '#0000ff',
                        borderColor: '#0000ff',
                        hoverBackgroundColor: '#CCCCCC',
                        hoverBorderColor: '#666666',
                        data: heat
                    }

                ]
            };

            var graphTarget = $("#graphCanvas");

            var myGraph = new Chart(graphTarget, {
                markerSize: 0,
                type: 'line',
                data: chartdata
            });
        });
    }
}

Graph with Markers (what I don't want)

Vladimir
  • 2,461
  • 2
  • 14
  • 18

0 Answers0