var circuits_1_=[];
for (var i = 0, len = FeaturesCC.length; i < len; i++) {
var circuit_1_={};
var FeatureCC = FeaturesCC[i];
id_circuit_array.push(FeatureCC.attributes['objectid']);
//var s = '<button id="myDivButton'+i+'">'+FeatureCC.attributes['layer']+'</button>';
//var x = document.createElement("BUTTON");
//var t = document.createTextNode(""+FeatureCC.attributes['layer']);
//x.appendChild(t);
circuit_1_={value:i+1, text:""+FeatureCC.attributes['layer']};
circuits_1_.push(circuit_1_);
}
这是我的代码,我试图制作属性&#34; text&#34;在circuits_1对象中,一个按钮。 我试过这个
circuit_1_={value:i+1, text:"<button id='smth"+i+"' type='button'>"+FeatureCC.attributes['layer']+"</button>"};
结果如下: enter image description here
我使用此变量作为我的图表的标签,因为我想创建可点击的标签:
chartPos_ParCircuit.addAxis("x",{
labels: circuits_1_,
}).addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major", includeZero: true }).
addPlot("default", { type: StackedColumns, gap: 10 });
但是id没有用,请帮帮我吧! PS:我正在使用DOJO API进行制图,如果你可以建议我另一个我可以制作可点击图表和可点击轴的API,请建议我!