Home Forums Chart Support data points of chart to table so that table and chart point look aligned to each

data points of chart to table so that table and chart point look aligned to each

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

    hello !!i am using chart library in my college project . i am ploting chart from local storage . i need to put table below in vertical header format so that chart data points and table data looks aligned. please provide me help asAP. I SHALL BE VERY GREATFULL TO U.
    `var canvasP = document.getElementById(“pieChart”)
    var ctxP = canvasP.getContext(‘2d’)
    var myPieChart = new Chart(ctxP, {type: ‘line’,
    data:
    {
    labels: JSON.parse(localStorage.getItem(“label”)),
    datasets: [
    {label: “DFT”, data: JSON.parse(localStorage.getItem(“dft”)), borderColor: “ORANGE”,fill: false,markerType: “triangle”},
    {label: “FUNCTIONAL”, data: JSON.parse(localStorage.getItem(“fun”)), borderColor: “GREEN”,fill: false,markerType: “circle”}
    ]
    },
    options: {
    legend: {
    display: true,
    position: “right”

    }
    }
    });

    addTable(myPieChart);

    function addTable(myPieChart){
    var tableData = “”;
    for(var i = 0; i < myPieChart.data.length; i++){
    tableData += “<tr>” + “<td style=’color:” + myPieChart.data[i].color + “‘>■” + myPieChart.data[i].name + “</td>”;

    tableData += “</tr>”;
    }
    $(“#chartData”).append(tableData)
    PLEASE LOOK INTO CODE IN TABLE FORMAT AND PROVIDE ME NECESSARY CHANGES AND PROVIDE ME THE FIDDLE OR IDea of changes in my code as i am a very new to java script

    #29384

    @humblefool15,

    In the above snippet, we couldn’t find chart options / code related to CanvasJS. Can you kindly create JSFiddle with CanvasJS Chart options that you are using and share it with us so that we can look into code, understand the scenario better and help you resolve?

    If you are looking for adding HTML table below chart showing dataPoints, please take a look at this JSFiddle.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.