【问题标题】:Google-Visualization Plugin Grails: How to set hAxis max value and color formattingGoogle-Visualization Plugin Grails:如何设置 hAxis 最大值和颜色格式
【发布时间】:2012-03-09 19:16:44
【问题描述】:

我在 grails 中使用google-visualization 并想配置两件事:

1) 如何设置横轴的最大值?
2) 如果 bar 列低于某个值,我该如何更改它?

这是我所拥有的:

<td>
<div id="${mach.divtag}" style="display:block;">    
<gvisualization:columnCoreChart elementId="${mach.divtag}" width="${150}"
     height="${120}" columns="${mac.columns}" data="${mach.datapoints}"
     title="${mach.name}" />
</div>

这是我希望在图表中更改的快照。

谢谢。我真的很感激任何帮助。

【问题讨论】:

    标签: grails grails-plugin


    【解决方案1】:

    来自FAQ

    问:如何设置可视化对象数据类型的值,例如 柱芯图的“hAxis”?

    答:您可以通过使用 Expando 或自定义 bean 类轻松地做到这一点。 “textColor”、“title”和“titleColor”是这个对象的字段。

    来自examples of the plugin

    <gvisualization:columnCoreChart elementId="columnchart" title="Company Performance" width="${400}" height="${240}" hAxis="${new Expando(title: 'Year', titleColor: 'red')}" columns="${companyPerformanceColumns}" data="${companyPerformanceData}" />
    

    因此,对于 a),使用 Expando 并设置 hAxis.maxValue,根据 Google API

    hAxis="${new Expando(maxValue:100)}"
    

    对于 b),您可能必须自己在 Javascript 中使用 Google API 来使用combination of getSelection() for all available bars and setSelection() with some kind of color modifier after you've interrogated its value 获取条形图。希望您可以从这里处理,否则请寻求咨询帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-24
      • 1970-01-01
      • 2017-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多