Jquery 如何在jqplot中显示虚线而不是实线 $(文档).ready(函数(){ //我们的数据渲染器函数返回以下形式的数组: //[x1,sin(x1)],[x2,sin(x2)],…] var=function(){ var数据=[[]]; 对于(var i=0;i
我不知道是否存在一种更容易实现这一点的方法,但这是可行的: 在函数Jquery 如何在jqplot中显示虚线而不是实线 $(文档).ready(函数(){ //我们的数据渲染器函数返回以下形式的数组: //[x1,sin(x1)],[x2,sin(x2)],…] var=function(){ var数据=[[]]; 对于(var i=0;i,jquery,jqplot,Jquery,Jqplot,我不知道是否存在一种更容易实现这一点的方法,但这是可行的: 在函数中打开jquery.jqplot.js$.jqplot.CanvasGridRenderer.prototype.drawaddlinectx.setLineDash([1,5]);在linectx.save();之后,只需最小化文件,将其另存为jquery.jqplot.min.js(或直接在最小化版本上应用这些更改),就可以了 请记住,现在所有图表都有虚线。如果这是一个问题,那么您需要向Grid类添加一个新属性,如lineDa
中打开jquery.jqplot.js
$.jqplot.CanvasGridRenderer.prototype.draw
addlinectx.setLineDash([1,5]);
在linectx.save();
之后,只需最小化文件,将其另存为jquery.jqplot.min.js(或直接在最小化版本上应用这些更改),就可以了
请记住,现在所有图表都有虚线。如果这是一个问题,那么您需要向Grid
类添加一个新属性,如lineDash
,并在$.jqplot.CanvasGridRenderer.prototype.draw
中相应地处理它
谢谢,效果很好。但是如果我必须删除垂直线,你能建议我吗?–Tarika 6分钟ago@Tarika这里已经回答了
$(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
});
});