我写了代码来绘制正多边形。但是它不会根据滑块值绘制。如何解决?
var n = brd.create('slider', [[0,-2],[8,-2],[3,5,10]], {name:'n',snapWidth:1});
var pol = brd.create('regularpolygon',[
function() { return [3, 0];},
function() { return [4, 0];},
function() { return [n.Value()];}]);
brd.unsuspendUpdate();
答案 0 :(得分:0)
实际上,在JSXGraph中,常规多边形不能采用动态数量的顶点。一种解决方法是使用曲线,请参见https://jsfiddle.net/6emrfzyu/1/:
function appendWithValidation() {
var source = SpreadsheetApp.getActive().getSheetByName("Source");
var destination = SpreadsheetApp.getActive().getSheetByName("Destination");
var newData = source.getDataRange().getValues();
while (destination.getDataRange().getValues().length>destination.getMaxRows()) {
destination.deleteRow(destination.getMaxRows());
}
for (var i=0; i<newData.length; i++) {
destination.appendRow(newData[i]);
}
source.getDataRange().clear();
}