# Are the histogram libraries of JFreeChart accessible?

**URL:** <https://forum.inductiveautomation.com/t/are-the-histogram-libraries-of-jfreechart-accessible/39769>\
**Category:** General Discussion\
**Tags:** ignition79\
**Created:** [October 16, 2020, 7:24pm UTC](https://forum.inductiveautomation.com/t/are-the-histogram-libraries-of-jfreechart-accessible/39769 "2020-10-16T19:24:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rod.holland](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@rod.holland](https://forum.inductiveautomation.com/u/rod.holland)\
**Post date:** [October 16, 2020, 7:24pm UTC](https://forum.inductiveautomation.com/t/are-the-histogram-libraries-of-jfreechart-accessible/39769/1 "2020-10-16T19:24:47Z")

</div>

We’re using Ignition `7.9.14`.

I was requested by one of my colleagues to get a decent histogram output in ignition. He didn’t care for some characteristics of barchart and wanted more. By this time I’d had some experience with JFreeChart, so I looked up what was available there. When I included

import org.jfree.data.statistics.HistogramDataset  
import org.jfree.chart.ChartFactory

I had no problem, great! But as soon as I tried to declare  
Histdataset=HistogramDataset()  
or  
chart = ChartFactory.createBarChart(plotTitle,…

I get the following errors:

NameError: name ‘HistogramDataset’ is not defined  
NameError: name ‘ChartFactory’ is not defined

Declaring an empty dataset is about the easiest thing you can do. Since the command ‘HistogramDataset’ failed, I’m thinking this part of JFreeChart may not be implemented in the underlying layers of ignition.

Has anybody got some ideas?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 16, 2020, 9:06pm UTC](https://forum.inductiveautomation.com/t/are-the-histogram-libraries-of-jfreechart-accessible/39769/2 "2020-10-16T21:06:43Z")

</div>

If the packages weren't available, you'd get an error on the import statement. The actual cause is Jython's slightly funky import statement behavior - check @pturmel's excellent explanation here:

> [@Accessing com.inductiveautomation.ignition packages in Python](http://forum.inductiveautomation.com/t/accessing-com-inductiveautomation-ignition-packages-in-python/39702/3):
>
> Let me elaborate a bit: The import behavior you were expecting corresponds to java’s import something.something.\*;. But in java, an import is really just syntactical sugar for programmer convenience. A java programmer can always spell out full class names without any import statement. Python/jython doesn’t work this way. In python/jython, import is a fundamental operation that makes other packages available within the scope, optionally removing a package prefix or renaming the object into t…

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [October 16, 2020, 10:17pm UTC](https://forum.inductiveautomation.com/t/are-the-histogram-libraries-of-jfreechart-accessible/39769/3 "2020-10-16T22:17:22Z")

</div>

We use @JordanCClark statUtils to do Histograms with the standard bar chart and line.

> [@Statistics Extensions for Ignition](http://forum.inductiveautomation.com/t/statistics-extensions-for-ignition/17100):
>
> After discussions elsewhere with @Brian on the forum, I’ve ported the statsutils library from [http://boltons.readthedocs.io](http://boltons.readthedocs.io) some changes from the originaL Removed the format\_histogram functions, as they were using unsupported string formatting. Maybe when Ignitions’s Jython gets upgraded, I can look at it again. Renamed remaining histogram function to histogram. Brevity is good. Added ‘raw’ flag to histogram function to give a one-dimensional list with repeat histogram values, instead…

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [October 16, 2020, 10:24pm UTC](https://forum.inductiveautomation.com/t/are-the-histogram-libraries-of-jfreechart-accessible/39769/4 "2020-10-16T22:24:53Z")

</div>

Just for example, sorry had to blur out the numbers but you will get the general idea.

 ![screenshot](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/4/c452424cd9f91fc03d06cfb71dc42d1e835280a1.png)
