Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何在jqplot中显示虚线而不是实线 $(文档).ready(函数(){ //我们的数据渲染器函数返回以下形式的数组: //[x1,sin(x1)],[x2,sin(x2)],…] var=function(){ var数据=[[]]; 对于(var i=0;i_Jquery_Jqplot - Fatal编程技术网

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
addline
ctx.setLineDash([1,5]);
在line
ctx.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
  });
});