Jas
Jas

Reputation: 15

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

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

and in the y axis the Integers associated with them

Is this possible? How would I approach this problem?

Most of the examples I've seen are just on ints and doubles

Thanks.

Upvotes: 1

Views: 894

Answers (1)

trashgod
trashgod

Reputation: 205875

Hashmap<String, Integer> sounds like a job for CategoryDataset and a bar chart; the BarChartDemo1 source is included in the distribution.

Upvotes: 1

Related Questions