Reputation: 2496
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 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.
Upvotes: 1
Views: 5288
Reputation: 11
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.
Upvotes: -1
Reputation: 12727
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
Upvotes: 3