本文介绍了在primefaces中自定义lineChart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目的素面中使用lineChart.

I'm using of lineChart in primefaces on my project.

我要自定义lineChart.

I want to customize lineChart.

如何更改背景颜色并删除lineChart网格?

how to change background color and remove grid of lineChart ?

推荐答案

您可以使用以下方法设置自定义设计:

You can set custom design with:

<script type="text/javascript">
  function customExtender() {
    this.cfg.grid = {
       ...........
    }
  }
</script>
...
<p:lineChart extender="customExtender" value="..." />

,只需查看jqplot文档 http://www.jqplot.com/docs /files/jqPlotOptions-txt.html 部分

and just check jqplot documentation http://www.jqplot.com/docs/files/jqPlotOptions-txt.htmlsection

   grid: {
        drawGridLines: true,        // wether to draw lines across the grid or not.
        gridLineColor: '#cccccc'    // *Color of the grid lines.
        background: '#fffdf6',      // CSS color spec for background color of grid.
        borderColor: '#999999',     // CSS color spec for border around grid.
        borderWidth: 2.0,           // pixel width of border around grid.
        shadow: true,               // draw a shadow for grid.
        shadowAngle: 45,            // angle of the shadow.  Clockwise from x axis.
        shadowOffset: 1.5,          // offset from the line of the shadow.
        shadowWidth: 3,             // width of the stroke for the shadow.
        shadowDepth: 3,             // Number of strokes to make when drawing shadow.
                                    // Each stroke offset by shadowOffset from the last.
        shadowAlpha: 0.07           // Opacity of the shadow
        renderer: $.jqplot.CanvasGridRenderer,  // renderer to use to draw the grid.
        rendererOptions: {}         // options to pass to the renderer.  Note, the default
                                    // CanvasGridRenderer takes no additional options.
    },

您可以在其中看到背景参数和drawGridLines:)

you can see background param and drawGridLines there :)

这篇关于在primefaces中自定义lineChart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 20:29