javascript - Creating a dynamic bar chart in Planet Press Connect and need to add labels -
i working in planet press connect. have created dynamic bar chart , need add labels data. can me. beginner in java script not sure do. below code have. creates need except labels.
if (results.length) { // data-chartdata attribute holds key value pairs of data var chartdata = []; function addvaluetoseries(labelfield, valuefield) { var temp = {}; temp['value_label'] = record.fields[labelfield]; // number of series dynamic, add value each series (var = 0; < record.tables['age'].length; i++) { temp['values_' + (i+1)] = record.tables['age'][i].fields[valuefield]; } chartdata.push(temp); } addvaluetoseries('pls_age2', 'pls_ageavg'); results.attr('data-chartdata', json.stringify(chartdata)); // connect series values var series = []; (var = 0; < record.tables['age'].length; i++) { series[i] = { 'title' : record.tables['age'][i].fields['pls_ageavg'], 'valuefield' : 'values_' + (i+1) }; } var graphsdata = { 'categoryfield' : 'value_label', 'graphs' : series }; results.attr('data-graphsdata', json.stringify(graphsdata)); }
Comments
Post a Comment