Struts 2 jquery plugin, chart plugin does not support categories

依然范特西╮ 提交于 2021-01-24 08:31:54

问题


The chart component in the Struts 2 jQuery plugin version 3.6 seems not supporting the category plugin for the sjc:chart.

I want to use Flot With “String” x-axis for chart and the best solution is to use jquery.flot.categories.js (Described at Flot With "String" x-axis).

As I reviewed some struts-jquery-plugin code, I found that the jquery.chart.struts2.js does not use this plugin, on the other hand the jquery.flot.categories.js file is in the struts2-jquery-chart-plugin-3.7.1.jar file.

Please let me know how can I fix it ?! I think I can extend the used jquery objects ( may be $.struts2_jquery_chart ) and add it but don't know how ?!


回答1:


It's easily fixable, just modify your jquery.chart.struts2.js and add the following code.

if ((o.xaxis && o.xaxis.mode === "categories") || (o.yaxis && o.yaxis.mode === "categories")) {
    self.require("js/flot/jquery.flot.categories" + self.minSuffix + ".js");
} 

If you like to know how to use custom theme with Struts2 jQuery plugin, you should read Overriding Struts2 jqGrid CSS.

References:

  • Struts2 jQuery Plugin 3.4.0 with improved Chart Tag released
  • ChartTag
  • Categories


来源:https://stackoverflow.com/questions/36673782/struts-2-jquery-plugin-chart-plugin-does-not-support-categories

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!