java - 在 primefaces 中自定义折线图

标签 java jsf primefaces linechart

我在我的项目中使用 primefaces 中的 lineChart。

我想自定义折线图。

如何更改折线图的背景颜色和去除网格?

最佳答案

您可以设置自定义设计:

<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

   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 :)

关于java - 在 primefaces 中自定义折线图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23823353/

相关文章:

eclipse - PrimeFaces 登录尝试(示例)失败

java - 在 Java 中加载类时如何管理内存?

jsf - java.lang.VerifyError : org/primefaces/behavior/confirm/ConfirmBehaviorHandler Wrong return type in function

使用 JSF 的 JQuery 日期选择器

javascript - 如何动态更改 JavaScript 函数的一行?

jsf - 葡萄牙语-巴西赛程表 - Primefaces

java - TestNG 中控制组测试顺序的是什么?

java - 一个类中的事件可以触发另一个类中的操作吗?

java - 如何从 JSpinner 结果值设置日历?

java - 必须单击 "Submit"按钮两次才能提交表单