Merge branch 'master' of git@github.com:jzy3d/jzy3d-api.git

This commit is contained in:
Martin Pernollet 2017-01-28 18:51:07 +01:00
commit 26cb04f037
7 changed files with 54 additions and 14 deletions

3
.gitignore vendored
View File

@ -9,3 +9,6 @@ target
*.log
*~/
*~
jzy3d-javafx/.classpath
jzy3d-jdt-core/.classpath

View File

@ -12,6 +12,19 @@ public class Histogram {
public Histogram(float min, float max, int bins){
initBins(min, max, bins);
}
public Histogram(List<Float> values, int bins){
float min = Float.MAX_VALUE;
float max = -Float.MAX_VALUE;
for(float v: values){
if(v<min)
min=v;
if(v>max)
max = v;
}
initBins(min, max, bins);
add(values);
}
private void initBins(float min, float max, int bins) {
data = new HashMap<Range,Integer>(bins);

View File

@ -14,8 +14,8 @@ public class TicToc {
public static TicToc T = new TicToc();
public TicToc() {
start = 0;
stop = 0;
start = System.nanoTime();
stop = System.nanoTime();
}
public void tic() {
@ -30,10 +30,15 @@ public class TicToc {
public double tocShow(String message) {
double stop = toc();
System.out.println(message + " " + elapsedSecond() + "s\t" + elapsedMilisecond() + "ms\t" + elapsedMicrosecond() + "micro");
System.out.println(tocString(message));
return stop;
}
private String tocString(String message) {
toc();
return message + " " + elapsedSecond() + "s\t" + elapsedMilisecond() + "ms\t" + elapsedMicrosecond() + "micro";
}
public long rawToc() {
stop = System.nanoTime();
return stop;

View File

@ -14,19 +14,29 @@ import org.jzy3d.plot3d.primitives.axes.layout.providers.StaticTickProvider;
public class Histogram2d {
protected Histogram model;
protected AbstractComposite drawable;
String ylabel = "Count";
String xlabel = "Value";
public Histogram2d(Histogram model) {
setModel(model);
}
/** Set global chart view settings to best draw this histogram. */
public Histogram2d(Histogram model, String xlabel, String ylabel) {
this(model);
this.ylabel = ylabel;
this.xlabel = xlabel;
}
/** Set global chart view settings to best draw this histogram. */
public void layout(Chart chart){
IAxeLayout layout = chart.getAxeLayout();
int ymax = getModel().computeMaxCount();
double[] ticks = {0, ymax/4, ymax/2, ymax/2 + ymax/4, ymax};
layout.setYTickProvider(new StaticTickProvider(ticks));
layout.setYAxeLabel("Count");
layout.setXAxeLabel("Value");
layout.setYAxeLabel(ylabel);
layout.setXAxeLabel(xlabel);
}
public void addTo(Chart chart){

View File

@ -6,7 +6,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
@ -19,7 +23,7 @@
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/jzy3d-api"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>

View File

@ -6,7 +6,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**/*.java" including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>

View File

@ -20,7 +20,8 @@
<repositories>
<repository>
<id>swt-repo</id>
<url>https://swt-repo.googlecode.com/svn/repo/</url>
<url> http://maven-eclipse.github.io/maven</url>
<!--<url>https://swt-repo.googlecode.com/svn/repo/</url>-->
</repository>
</repositories>
@ -33,14 +34,14 @@
<dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
<version>4.2.1</version>
<version>4.3</version>
</dependency>
<!--<dependency> <groupId>org.eclipse.swt.win32.win32</groupId> <artifactId>x86</artifactId>
<version>4.2.1</version> </dependency> -->
<version>4.3</version> </dependency> -->
<dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
<version>4.2.1</version>
<version>4.3</version>
</dependency>
<dependency>
@ -90,7 +91,7 @@
<!--<excludes> <exclude>org/jzy3d/junit/ChartTest.java</exclude> </excludes> -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>