knowm / xchart Goto Github PK
View Code? Open in Web Editor NEWXChart is a light-weight Java library for plotting data.
Home Page: http://knowm.org/open-source/xchart
License: Apache License 2.0
XChart is a light-weight Java library for plotting data.
Home Page: http://knowm.org/open-source/xchart
License: Apache License 2.0
Is it possible to get an access to a JFrame which is created by
new SwingWrapper(chart).displayChart();
?
Actually displayChart() returns void. I would like to gain access to that JFrame because i'd like to set:
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
.
Currently when I close that frame the whole application exists.
Polynomial, exponential, Gaussian, others...
The description can be found here: #52
e.g. sometimes i need such chart:
Collection<Number> xData = new ArrayList<Number>();
Collection<Number> yData = new ArrayList<Number>();
for ( int i = 0; i < 10; i++ ){
xData.add(i);
yData.add(i*i);
}
xData.add(10);
yData.add(null);
It would be great if seriesName can recognize new line character '\n' and render it on legend properly
Sometimes it's necessary to set the minimum/maximum values on an axis. I propose to add a function that calls the AxisPair addMinMax function so that you can at least increase the range if needed.
I've forked the code and have added this and will send a pull request once it's tested.
I'm trying to display date formats such as "yyyy-MM-dd HH:mm:ss" and currently, the fact that the labels are displayed horizontally greatly limits the total number of labels that can be printed along the X Axis.
I would like to be able to provide an angle to which the labels get tilted (between 0 and 360°). To maximize space, a 90° or 180° angle could then be used.
PS: I just noticed I can't seem to find a way to define the number of gradations on the X-Axis either (i.e some sort of granularity that defines the number and length of each interval). That seems like it would be a good combination with the feature I'm asking here, if it doesn't already exist.
Someone wanted this functionality here: http://stackoverflow.com/questions/14767577/how-to-make-limits-on-the-y-axis-be-the-same-using-xchart
did you change something?
Hopefully this will be fixed, was my first target to download the latest release
I got this in an email today...
I was playing around with the new setX/YAxisMin/Max, and found some unexpected results, as show in these screenshots:
This shows two sets of data plotted on a log plot, with Xchart choosing the axis ranges:
double[] xData = new double[]{0.0, 1.0, 2.0, 3.0, 4.0 ,5,6};
double[] yData = new double[]{106, 44, 26,10, 7.5, 3.4,.88};
double[] yData2 = new double[]{102,49,23.6,11.3,5.4,2.6,1.25};
mychart.getStyleManager().setYAxisLogarithmic(true);
For the plot below I set Y-axis range to 0.01 - 1000 in the code. The axes draw properly, but the data are misplaced:
mychart.getStyleManager().setYAxisLogarithmic(true);
mychart.getStyleManager().setYAxisMin(0.01);
mychart.getStyleManager().setYAxisMax(1000);
Below are the same data, plotted with the x axis limits set to -5 and 10, again the axes are correct but the data misplaced:
mychart.getStyleManager().setXAxisMin(-5);
mychart.getStyleManager().setXAxisMax(10);
When the frame to display a chart is too small for the chart to be displayed, the code below will go into an infinite loop (in the while loop):
private BigDecimal getGridStep(int tickSpace) {
// the span of the data
double span = Math.abs(maxValue.subtract(minValue).doubleValue()); // in data space
int tickMarkSpaceHint = (axisDirection == Direction.X ? DEFAULT_TICK_MARK_STEP_HINT_X : DEFAULT_TICK_MARK_STEP_HINT_Y);
// for very short plots, squeeze some more ticks in than normal
if (axisDirection == Direction.Y && tickSpace < 160) {
tickMarkSpaceHint = 25;
}
double gridStepHint = span / tickSpace * tickMarkSpaceHint;
// gridStepHint --> significand * 10 ** exponent
// e.g. 724.1 --> 7.241 * 10 ** 2
double significand = gridStepHint;
int exponent = 0;
if (significand == 0) {
exponent = 1;
}
else if (significand < 1) {
while (significand < 1) {
significand *= 10.0;
exponent--;
}
}
When using the SwingWrapper with a Chart (generated by QuickChart, don't think that's relvant), if the window is scaled too small, the window stops updating and the whole frame hangs. The window can't be normally closed either, it has to be force-closed.
Hello i havedownload and unzipped the files. but when i try to run the jar by clicking it it doesn't do anything
Can you help me hot to install it and how to start using it?
Like most charting libraries, multiple x-axes per chart should be possible such as shown here: https://bitcoinium.com/ using the Flot Javascript library. Each series should be assignable to an axis. Each axis should be shown on the chart and it should be possible to define whether the axis goes on the left or right side. The data plot should of course scale to the full extend of each axis.
The original feature request for this can be found here: #31
It would be nice to have possibility to create a chain of settings for an series.
Currently I can set only one parameter:
chart.addSeries( ... ).setLineColor(Color.red);
And to be honest I don't have idea how to set another one :)
However, if setLineColor()
(and other) will returns Series I can write something like:
chart.addSeries( ... ).setLineColor(Color.red).setMarker(...);
and so on.
If there is another way to achieve this let me know.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.