Answer the question
In order to leave comments, you need to log in
[[+content_image]]
How to visualize data from the Yandex.metrics API in jQuery.flot.chart.js?
Good day, gurus!
The question is what do you need to make a dashboard for the admin panel, I found an interesting library (flot.js) but it wants to take an array of this form [[0,1],[1,3],[2,-4],[3, 2],[4,0.5],[5,0.7],[6,-1],[7,4],[8,2]], where the first is the y-axis and the second is x. But, the J.M API gives json like this:
array(5) {
[0]=>
object(stdClass)#5 (11) {
["wday"]=>
int(0)
["denial"]=>
int(0)
["visits"]=>
int(2)
["new_visitors_perc"]=>
int(0)
["page_views"]=>
int(13)
["date"]=>
string(8) "20141006"
["visit_time"]=>
int(1243)
["depth"]=>
float(6.5)
["new_visitors"]=>
int(0)
["visitors"]=>
int(1)
["id"]=>
string(8) "20141006"
}
[1]=>
object(stdClass)#6 (11) {
["wday"]=>
int(6)
["denial"]=>
int(0)
["visits"]=>
int(2)
["new_visitors_perc"]=>
int(0)
["page_views"]=>
int(2)
["date"]=>
string(8) "20141005"
["visit_time"]=>
int(15)
["depth"]=>
int(1)
["new_visitors"]=>
int(0)
["visitors"]=>
int(2)
["id"]=>
string(8) "20141005"
}
[2]=>
object(stdClass)#7 (11) {
["wday"]=>
int(5)
["denial"]=>
int(0)
["visits"]=>
int(1)
["new_visitors_perc"]=>
int(0)
["page_views"]=>
int(1)
["date"]=>
string(8) "20141004"
["visit_time"]=>
int(16)
["depth"]=>
int(1)
["new_visitors"]=>
int(0)
["visitors"]=>
int(1)
["id"]=>
string(8) "20141004"
}
[3]=>
object(stdClass)#8 (11) {
["wday"]=>
int(4)
["denial"]=>
int(0)
["visits"]=>
int(1)
["new_visitors_perc"]=>
int(0)
["page_views"]=>
int(1)
["date"]=>
string(8) "20141003"
["visit_time"]=>
int(15)
["depth"]=>
int(1)
["new_visitors"]=>
int(0)
["visitors"]=>
int(1)
["id"]=>
string(8) "20141003"
}
[4]=>
object(stdClass)#9 (11) {
["wday"]=>
int(3)
["denial"]=>
int(0)
["visits"]=>
int(2)
["new_visitors_perc"]=>
int(1)
["page_views"]=>
int(62)
["date"]=>
string(8) "20141002"
["visit_time"]=>
int(5391)
["depth"]=>
int(31)
["new_visitors"]=>
int(2)
["visitors"]=>
int(2)
["id"]=>
string(8) "20141002"
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question