I am using HighCharts to draw graphs and some code redundancy that I want to reduce
The code looks like this:
data = [[y: pageviews [0], color: color [0], drilldown: {name: date [0], categories: ['A', 'b', 'c'], data: [photosR [0], rating r [0], searches [0], social r [0]], color: color [0]}}, [y [Page] [1] Color: Color [1], Drilldown: {Name: Date [1], Categories: ['A', 'B', 'C'], Data: [PhotoR [1], Rating R [1 ], B See [1], SocialR [1]], Color: Color [1]}}] This hierarch is a drill down bar chart, I write the code given below 2 times Instead of wanting a loop
y: pageviews [0], color: color [0], drilldown: {...} I think That's what he has to do with the object, but there is still a lot to learn about it.
It seems that all your arrays have the same length, so from them Isi is protected in the loop.
It should work for you:
var data = []; (Var i = 0; i & lt; pageViews.length; i ++) {data.push ({y: pageviews [i], color: color [i], drilldown: {name: date [i], Categories: ['A', 'b', 'c'], data: [photosR [i], ratings r [i], searches r [i], social r [i]], color: color [i]}} ); }
No comments:
Post a Comment