jquery – jqplot,删除外边框

前端之家收集整理的这篇文章主要介绍了jquery – jqplot,删除外边框前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

如何删除jqplot的外边框,请看下面的截图.
我尝试了不同的选项并搜索它,但我没有得到解决方案.

这是我的代码,

  1. plot1 = $.jqplot(container,[data],{
  2. title: 'title',animate: true,animateReplot: true,seriesColors:['#00ADEE'],seriesDefaults: {
  3. renderer: $.jqplot.BarRenderer,shadow: false
  4. },axesDefaults: {
  5. },Highlighter: {
  6. tooltipAxes: 'y',show: true,tooltipLocation: 'sw',formatString: 'Highlighter"> \
  7. 请帮帮我.提前致谢.

  8. 这是JsFiddle link,我想删除外边框.

  9. 最佳答案
  10. 您可以在postDrawHooks注册自定义函数,在插件初始化后触发.

  11. 我们的想法是使用此功能在图表顶部绘制一个白色边框矩形,使外边框不可见.

  12. $.jqplot.postDrawHooks.push(function() {
  13.     var $canvasMain = $("#chart1 canvas.jqplot-grid-canvas"),$canvasLines = $("#chart1 canvas.jqplot-series-canvas"),canvasSize = { 
  14.             x: parseInt($canvasLines.attr('width')),y: parseInt($canvasLines.attr('height'))
  15.         },ctx = $canvasMain[0].getContext('2d');
  16.     ctx.strokeStyle = 'white';
  17.     ctx.lineWidth = 6; // 6 to hide shadows and the larger bottom side
  18.     ctx.rect($canvasLines.position().left,$canvasLines.position().top,canvasSize.x,canvasSize.y + 3);
  19.     ctx.stroke();    
  20. });
  21. 你可以看到外边界消失了:

  22. 这工作正常,但我个人会继续修改源以跳过外部边界.该插件使用GPLv2和MIT双重许可,所以我想这条路线没有问题.

  23. 我发现如果你改变这个

  24. grid: {borderColor: 'transparent',
  25. grid: {borderColor: 'white',drawBorder: true},
  26. 外边框消失了(我上面做的那种),但是x轴上仍然会出现一些刻度线.我设置了showTickMarks:false表示没有成功.

    • 猜你在找的CSS相关文章