JpGraph图例顺序
我正在使用带有 JpGraph 的累积条形图,并且想要更改项目在图例中出现的顺序(我想按字母数字顺序对它们进行排序)。我检查了文档,但没有找到任何相关内容:我有任何选项可以实现此目的吗? (JpGraph似乎自己对图例进行排序)
I'm using an accumulated bar plot with JpGraph and want to change the order in which the items appear in the legend (I want to sort them alphanumerically). I've checked the documentation, but didn't find anything related: do I have any options for achieving this? (JpGraph seems to sort the legend on its own)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可悲的是,我不相信直接存在:
您可以按照您的意愿以编程方式对您的系列进行排序,然后将它们按您想要的顺序推送到图表以实现您想要的...
Sadly, I dont believe there is directly, however:
You could programatically sort your series as you wish before pushing them to the graph in your desired order to achieve what you're after...
在jpgraph-4.4.2/src/jpgraph_bar.php中,在Function Legend中更改for语句的顺序!看来是故意扭转的。不是
肯定为什么。
这是原始代码:
这是适合我的新代码:
唯一的区别是更改 for 语句!
In jpgraph-4.4.2/src/jpgraph_bar.php, in the Function Legend change the order of the for statement! It seems to reverse it intentionally. Not
sure why.
Here is the original code:
Here is the new code that works for me:
Only difference is changing the for statement!