jfree / jfreechart

A 2D chart library for Java applications (JavaFX, Swing or server-side).
http://www.jfree.org/jfreechart/
GNU Lesser General Public License v2.1
1.22k stars 461 forks source link

Piechart with Negative Values #39

Open halomanish opened 7 years ago

halomanish commented 7 years ago

As a part of my Phd work on software testing, I discovered a small issue in the piechart functionality of JFreeChart.

In the createPieChart method of the ChartFactory class: if a negative value is provided in the dataset to be used for the pie chart, it is simply ignored while creating the pie chart and JFreeChart plots the pie chart using the rest positive values of the data set. Contrary to this behavior, the application should generate an error message as it is impractical to plot a pie chart with negative values.

jfree commented 7 years ago

I think you are correct that it is better to "fail-fast" if the pie dataset contains negative values. However, I have to think about whether to change this as it has been implemented this way a long time ago and is documented in the PiePlot Javadocs.