开发者

loading highcharts with data from database

Hi i am new to highcharts and zend. i installed highcharts in my zend view and able to draw a chart with some dummy data. now i want to create a chart with data from my database. my data contains the weight of the user and the date of weight measurement.

    x axis will be the weight of the user
    y axis will be 开发者_StackOverflow社区the date of weight measurement  

i have the database ready but i don't have any idea about how to create the chart from that data in my database. thanks.


Often the x axis is used for the time value, but you can invert the chart by setting the inverted property to true to swap places for x and y axes (essentially making the time axis vertical instead of horizontal):

chart: {
    renderTo: 'container',
    type: 'spline',
    inverted: true   // <== inverted chart
},

xAxis: {
    type: 'datetime',
},

series: [{
    data: [[Date.UTC(2011, 0, 1), 69.9],
          [Date.UTC(2011, 0, 2), 71.5],
          [Date.UTC(2011, 0, 3), 76.4],
          [Date.UTC(2011, 0, 4), 81.5],
          [Date.UTC(2011, 0, 5), 80.4]]
}]

I made an example for you on jsfiddle showing this: http://jsfiddle.net/emWm7/

Reference doc: http://www.highcharts.com/ref/index.php#chart--inverted


I have two code samples you can use. One is generating tab-separated values from your table. The other is generating JSON string from your table.

Tab-separated values example here.

JSON example here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜