如何在 jqplot 中显示虚线而不是实线
how to show dotted grid lines in jqplot instead of solid lines
$(document).ready(function(){
// Our data renderer function, returns an array of the form:
// [[[x1, sin(x1)], [x2, sin(x2)], ...]]
var sineRenderer = function() {
var data = [[]];
for (var i=0; i<13; i+=0.5) {
data[0].push([i, Math.sin(i)]);
}
return data;
};
// we have an empty data array here, but use the "dataRenderer"
// option to tell the plot to get data from our renderer.
var plot1 = $.jqplot('chart1',[],{
title: 'Sine Data Renderer',
dataRenderer: sineRenderer
});
});
In this chart i have to set dotted grid lines in background.
is this possible to draw dotted grid lines in jqplot
我不知道是否存在更简单的方法来完成此操作,但这可行:
打开 jquery.jqplot.js
。在函数 $.jqplot.CanvasGridRenderer.prototype.draw
中,在行 ctx.save();
之后添加行 ctx.setLineDash([1, 5]);
。然后最小化文件,将其另存为 jquery.jqplot.min.js
(或直接在最小化版本上应用这些更改)就可以了。
请记住,您所有的图表现在都会有虚线。如果这是一个问题,那么您需要像 lineDash
添加一个新的 属性 到 Grid
class 并在 $.jqplot.CanvasGridRenderer.prototype.draw
.[=19= 中相应地处理它]
$(document).ready(function(){
// Our data renderer function, returns an array of the form:
// [[[x1, sin(x1)], [x2, sin(x2)], ...]]
var sineRenderer = function() {
var data = [[]];
for (var i=0; i<13; i+=0.5) {
data[0].push([i, Math.sin(i)]);
}
return data;
};
// we have an empty data array here, but use the "dataRenderer"
// option to tell the plot to get data from our renderer.
var plot1 = $.jqplot('chart1',[],{
title: 'Sine Data Renderer',
dataRenderer: sineRenderer
});
});
In this chart i have to set dotted grid lines in background. is this possible to draw dotted grid lines in jqplot
我不知道是否存在更简单的方法来完成此操作,但这可行:
打开 jquery.jqplot.js
。在函数 $.jqplot.CanvasGridRenderer.prototype.draw
中,在行 ctx.save();
之后添加行 ctx.setLineDash([1, 5]);
。然后最小化文件,将其另存为 jquery.jqplot.min.js
(或直接在最小化版本上应用这些更改)就可以了。
请记住,您所有的图表现在都会有虚线。如果这是一个问题,那么您需要像 lineDash
添加一个新的 属性 到 Grid
class 并在 $.jqplot.CanvasGridRenderer.prototype.draw
.[=19= 中相应地处理它]