-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…ion was made to anchor min y axis to 0 for bar and stick category charts, but not for other category chart types.
- Loading branch information
Showing
5 changed files
with
78 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
xchart-demo/src/main/java/org/knowm/xchart/standalone/issues/TestForIssue826.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.knowm.xchart.standalone.issues; | ||
|
||
import java.text.ParseException; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import org.knowm.xchart.CategoryChart; | ||
import org.knowm.xchart.CategoryChartBuilder; | ||
import org.knowm.xchart.SwingWrapper; | ||
|
||
public class TestForIssue826 { | ||
|
||
public static void main(String[] args) throws ParseException { | ||
|
||
CategoryChart chart = getChart(); | ||
new SwingWrapper(chart).displayChart(); | ||
} | ||
|
||
public static CategoryChart getChart() { | ||
final CategoryChart chart = | ||
new CategoryChartBuilder().width(600).height(400).xAxisTitle("X").yAxisTitle("Y").build(); | ||
|
||
ArrayList<String> years = | ||
new ArrayList<String>( | ||
Arrays.asList( | ||
new String[] { | ||
"2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", | ||
"2022" | ||
})); | ||
|
||
ArrayList<Number> yAData = | ||
new ArrayList<Number>( | ||
Arrays.asList( | ||
new Number[] { | ||
4438887, 4365843, 4050498, 4757380, 4429130, 4692889, 4354087, 4530343, 4572770, | ||
4150489, 4487793 | ||
})); | ||
|
||
ArrayList<Number> yBData = | ||
new ArrayList<Number>( | ||
Arrays.asList( | ||
new Number[] { | ||
3198714, 3144079, 2859215, 3430605, 3839149, 4042579, 3741823, 3890162, 3731367, | ||
3751216, 4008249 | ||
})); | ||
|
||
chart.getStyler().setOverlapped(true); | ||
chart.getStyler().setYAxisDecimalPattern("###,###.##"); | ||
|
||
chart.addSeries("A", years, yAData); | ||
chart.addSeries("B", years, yBData); | ||
|
||
// chart.getStyler().setYAxisMin(2600000.0); | ||
chart.setTitle(Double.toString(2600000.0)); | ||
|
||
return chart; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters