How to make a graph using PHP from oracle

前端 未结 1 1890
囚心锁ツ
囚心锁ツ 2021-01-24 07:31

I want to create a graph that the data are from oracle by using php. I did not found example that use oracle as a database. Mostly are from mysql. The data is like this

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-24 08:18

    Since the data is this:

     [{"0":"8","QUANTITY":"8","1":"Set A","PACKAGENAME":"Set A"},{"0":"5","QUANTITY":"5","1":"Set B","PACKAGENAME":"Set B"}]
    

    You have a case sensitivity problem, which makes the array var packagename and quantity empty/undifined.

    You need to change:

        for(var i in data) {
            packagename.push("Packagename " + data[i].packagename);
            quantity.push(data[i].quantity);
        }
    

    ... to ...

        for(var i in data) {
            packagename.push("Packagename " + data[i].PACKAGENAME);
            quantity.push(data[i].QUANTITY);
        }
    

    I am not familiar with Chart.js but fixing this so that you are not trying to graph undefined variables is a first step.

    0 讨论(0)
提交回复
热议问题