Comments (2)
Thank you for the bug report. Could you paste a working example showing the issue in code format so I can reproduce and debug? You can use this as a starting point:
public class TestForIssue834 {
public static void main(String[] args) throws ParseException {
XYChart chart = getXYChart();
new SwingWrapper(chart).displayChart();
}
public static XYChart getXYChart() {
XYChart chart =
new XYChartBuilder()
.width(720)
.height(480)
.title("getXYSeriesRenderStyle Example")
.xAxisTitle("Count")
.yAxisTitle("Value")
.build();
double[] xValues = new double[] {1, 2, 3};
double[] yValues = new double[] {1, 2, 3};
chart.addSeries("main", xValues, yValues);
return chart;
}
}
from xchart.
Hi there, here is a quick working example:
import org.knowm.xchart.*;
import java.text.ParseException;
public class TestForIssue834 {
public static void main(String[] args) throws ParseException {
XYChart chart = getXYChart();
new SwingWrapper(chart).displayChart();
}
private static String customYAxisTickLabelsFormatter(Double value) {
System.out.println("Formatting Y Axis Tick Value: " + value);
if (value < 1e3) {
return String.format("%.0f nJ", value);
} else if (value < 1e6) {
return String.format("%.2f µJ", value / 1e3);
} else if (value < 1e9) {
return String.format("%.2f mJ", value / 1e6);
} else {
return String.format("%.2f J", value / 1e9);
}
}
public static XYChart getXYChart() {
XYChart chart =
new XYChartBuilder()
.width(720)
.height(480)
.title("getXYSeriesRenderStyle Example")
.xAxisTitle("Count")
.yAxisTitle("Value")
.build();
// todo: uncomment this line to see the error show up in the chart
// chart.setCustomYAxisTickLabelsFormatter(TestForIssue834::customYAxisTickLabelsFormatter);
chart.getStyler().setYAxisLogarithmic(true);
double[] xValues = new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
double[] yValues = new double[] {1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8};
chart.addSeries("main", xValues, yValues);
return chart;
}
}
Thank you.
from xchart.
Related Issues (20)
- setting the size (dimensions) of the image when saving
- Upgrade to de.rototor.pdfbox:graphics2d 3.0.1 HOT 3
- need a price and time information listener by moving the mouse over the candlechart HOT 1
- Histogram : How to have only integer values in x axis ?
- How to remove extra space below min y-axis value?
- Boxplot width
- CategoryChart y axis wrong on 3.8.7 while bars are correct HOT 1
- XYChart color scale
- Labels in XYChart? HOT 3
- maven junit test not executed with xchart dependency present HOT 1
- XYSeries.getXYSeriesRenderStyle() is null even after variable Assignment HOT 1
- Feature Request: Enforce Different Colors for Up and Down Candles in OHLC Chart HOT 1
- Bug: BitmapEncoder not accepting uppercase format of extension HOT 1
- ChartZoom has bug!
- Annotations
- Output for terminal/console
- NPE on tooltips with BitmapEncoder.saveBitmap
- allow setting custom tick marks
- Ability to change locale in PieStyler missing?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xchart.