[Chartjs]-Why I don't see the second plot?

1👍

You need to add one dataset with type “scatter” in the line datasets. You can checkout their mixed chart documentation here http://www.chartjs.org/docs/latest/charts/mixed.html.

You can checkout my running example here https://jsfiddle.net/sherlcode13/m3mfz6jh/5/

    var ctx = new Chart(document.getElementById("line-chart"), {
    type: 'line',
    data: {
        labels: [18.123,46.8603108462,75.5976216923,104.334932538],
        datasets: [{
            data: [418872.777267,262233.131655,180687.131758,133676.324505],
            label: "Model",
            borderColor: "#3e95cd",
            fill: false     
        }, {
            label : 'Data',
            fill:false,
            showLine: false,
            data : [{x: 17.0, y: 454995.091169},
            {x: 18.0, y: 457656.874749},
            {x: 19.0, y: 444574.49162},
            {x: 20.0, y: 432511.514968},
            {x: 21.0, y: 421184.776328}],
                type: 'scatter'
        }
            ]        
    },
    options: {
        title:{
            display: true,
            text:"Test"
        },
        scales: {
            xAxes: [{
                type: 'logarithmic',
                position: 'bottom'
            }],
            yAxes: [{
                type: 'logarithmic'
            }]
        }
    }
})

0👍

You can use the mixed chart, it is possible to create mixed charts that are a combination of two or more different chart types

http://www.chartjs.org/docs/latest/charts/mixed.html

Leave a comment