Skip to content

Commit

Permalink
test chart for issue #707
Browse files Browse the repository at this point in the history
  • Loading branch information
timmolter committed Apr 25, 2024
1 parent 0450897 commit 9d84462
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.knowm.xchart.standalone.issues;

import org.knowm.xchart.CategoryChart;
import org.knowm.xchart.CategoryChartBuilder;
import org.knowm.xchart.CategorySeries;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.style.Styler;

import java.text.ParseException;

public class TestForIssue707 {

public static void main(String[] args) throws ParseException {

CategoryChart chart = getCategoryChart();
new SwingWrapper(chart).displayChart();
}

public static CategoryChart getCategoryChart() {
double[] xData = new double[] { 0.0, 1.0, 2.0, 3.0, 4.0 };
double[] yData = new double[] { 2.0, 1.5, 4.0, 3.77, 2.5 };

// Create Chart
CategoryChartBuilder builder = new CategoryChartBuilder();
builder.title("Sample Chart")
.xAxisTitle("X")
.yAxisTitle("Y")
.theme(Styler.ChartTheme.Matlab);
CategoryChart chart = builder.build();
// chart.getStyler().setYAxisMin(1.0);
chart.getStyler().setLabelsVisible(true);
//.setDefaultSeriesRenderStyle(CategorySeries.CategorySeriesRenderStyle.Line).

chart.addSeries("y(x)", xData, yData);

return chart;
}
}

0 comments on commit 9d84462

Please sign in to comment.