简体   繁体   English

Jfreechart:如何制作一个在x轴上具有String且在y轴上具有Integers的直方图?

[英]Jfreechart: how to make a histogram that has Strings in the x axis and Integers in the y axis?

I have a Hashmap 我有一个哈希图

the values are just strings and the Integers a number that represents the amount of times the String appears in a text 这些值只是字符串,而Integers是一个数字,表示字符串在文本中出现的次数

I would like to use this hashmap in order to create a histogram or a graph in general that would have in the x axis, the Strings from the hashmap 我想使用此哈希图来创建通常在x轴上具有哈希图字符串的直方图或图

and in the y axis the Integers associated with them 在y轴上与它们关联的整数

Is this possible? 这可能吗? How would I approach this problem? 我将如何解决这个问题?

Most of the examples I've seen are just on ints and doubles 我见过的大多数示例只是整数和双精度

Thanks. 谢谢。

Hashmap<String, Integer> sounds like a job for CategoryDataset and a bar chart; Hashmap<String, Integer>听起来像CategoryDataset和条形图的工作; the BarChartDemo1 source is included in the distribution. BarChartDemo1 包含在分发中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM