Giter Club home page Giter Club logo

jzy3d-api's Issues

Bar chart depth buffer

When drawing a bar chart the order of the planes in incorrect because the depth buffer is not working properly. The planes look weird and dissapear when rotating. This also occurs in guide-samples org.jzy3d.demos.histogram.barchart. Can you fix it please, we really need it :)

Error in Angle2d and Angle3d angle() calculation

The following test fails because the angle() method returns NaN. If this does turn out to be a bug, Angle3d probably has the same or similar issue.

@Test
public void angleShouldBe45Deg() {
    Angle2d a2d = new Angle2d(new Coord2d(2, 2), new Coord2d(0, 0), new Coord2d(2, 0));
    float calculatedAngle = a2d.angle();
    float expectedAngle = 0.785398163f; // 45 deg
    assertEquals(Float.valueOf(expectedAngle).doubleValue(), Float.valueOf(calculatedAngle).doubleValue(), 0.0001);
}

NewtToAWTKeyListener and Other Listeners

It seems that NewtToAWTKeyListener is actually another AWTToNewtKeyListener, judging from the input / output arguments.

Cloned from master branch in the repository. Also, AWTToNewtUtilities seems to be backwards (input argument is explicitly java.awt.event.KeyEvent, but switches using the com.jogamp.newt.event.KeyEvent).

Did I download from a weird repository?

Wrong axes layout in 2D

Dear jzy3D team,

I have observed the following issue: when the view is in "2D mode" (both using ViewPositionMode.FREE or ViewPositionMode.TOP), axes layout is wrong since labels are overlapped within axes and chart. You can see this effect in the following image:
2d-wrong-axes

However, as you can see in the following two images, when the view is in "3D mode" (even when it is very close to the "2D/Top" view), labels are correctly displayed without being overlapped.

3d-right-axes-2
3d-right-axes

Is there any way to fix it? Can you consider fixing this issue in jzy3d?

Thank you very much for your support.

Regards.

strange behaviour in mac osx : ultra low resolution of first rendering

the same code in Win32 works fine:
image

However , in mac osx 10.9:
screen shot 2014-08-02 at 20 29 20

sometimes it even crashed:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff8b892c6f, pid=2755, tid=6403
#
# JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [CoreFoundation+0x26c6f]  CFDataGetBytePtr+0xf

newt screenshots do not work in windows (colons)

Screenshot time gets encoded using colons, which are not allowed characters in Windows.

Caused by: java.io.FileNotFoundException: .\data\screenshots\capture-05\01\2014 10:26:51.png (The filename, directory name, or volume label syntax is incorrect)

Error in Chart Demo

Line:18

AnalysisLauncher.open(new ScatterDemo());

Where is ScatterDemo class constructor? How to locate or point to ScatterDemo?

Line 42,43
chart = AWTChartComponentFactory.chart(Quality.Advanced, "newt");

The Chart object is not declared.

Calling view.getCanvasAsGLAutoDrawable() with a Newt canvas triggers an exception

In Newt Canvas i am trying to capture mouse and keyborad events and getting issue when i try to add picking support. On mouse press event when i am trying to get currentGL it gives me exception "
java.lang.RuntimeException: Unexpected instance type
at org.jzy3d.plot3d.rendering.view.View.getCanvasAsGLAutoDrawable(View.java:694)
at org.jzy3d.plot3d.rendering.view.View.getCurrentContext(View.java:685)
at org.jzy3d.plot3d.rendering.view.View.getCurrentGL(View.java:680)
at org.jzy3d.plot3d.rendering.view.View.projectMouse(View.java:163)
at

Improve clarity of MousePickingController behaviour

MousePickingController's wheel should zoom on Z like CameraMouseController.
MousePickingPan2dController's should do what MousePickingController does: zoom on X and Y.

Picking controller should better be registered through chart.addController(...) to have similar behaviour than other controllers.

Error in AWTChartComponentFactory

AWTChartComponentFactory newFrameSwing incorrectly looking for org.jzy3d.bridge.awt.FrameSwing
should be
org.jzy3d.bridge.swing.FrameSwing

jzy3d-jdt-core tests are failing on Windows

When building the project on Windows, the test SmokeTest.shouldRunOnExampleData is failing because two compared files do not have the same line endings. The error is:

Running il.ac.idc.jdt.SmokeTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@17d10166
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.696 sec <<< FAILURE!
shouldRunOnExampleData(il.ac.idc.jdt.SmokeTest)  Time elapsed: 0.231 sec  <<< FAILURE!
java.lang.AssertionError: t1_1000.tsin trangulation is correct for smf
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:26)
        at il.ac.idc.jdt.SmokeTest.shouldRunOnExampleData(SmokeTest.java:28)

Results :

Failed tests:   shouldRunOnExampleData(il.ac.idc.jdt.SmokeTest): t1_1000.tsin trangulation is correct for smf

This happens because the control files inside the folder jzy3d-jdt-core\src\test\resources\outputs have Unix line endings (\n) when the created temporary files have Windows line-endings (\r\n).

A possible solution is to use IOUtils.contentEqualsIgnoreEOL inside this test (and giving it a Reader, by wrapping the InputStream with a InputStreamReader) instead of IOUtils.contentEquals.

This was brought up in a Stack Overflow question: http://stackoverflow.com/questions/34766439/failure-to-execute-goal-maven-surefire-plugin-on-child-module-for-jzy3d-program

Provide source and javadoc jars on deployment

It would be very helpful for development time to attach source and javadoc jars to the binary libs in ones IDE. Providing such jars is very easy using Maven with the help of the maven-source-plugin resp. maven-javadoc-plugin.

TextBillboardRenderer Only Shows Blocks

The call to glBitmap only uses nonascii static byte[] instead of using the nonascii2 byte[] param, causing only blank boxes to show up. Is this a mistake?

private void glBitmap(GL gl, int charWidth2, int charHeight2, float xorig, float yorig, float xmove, float ymove, byte[] nonascii2, int i) {
    if (gl.isGL2()) {
        gl.getGL2().glBitmap(charWidth, charHeight, xorig, yorig, xmove, ymove, nonascii, 0);
    } else {
        GLES2CompatUtils.glBitmap(charWidth, charHeight, xorig, yorig, xmove, ymove, nonascii, 0);
    }

}

Improve documentation of View.getCurrentGL()

Retrieving current GL imply synchronisation and locking in JOGL. If the user is not aware of this, he/she might encounter exception if the context is not release as expected.

See Britta's report: https://groups.google.com/forum/?fromgroups=#!topic/jzy3d/P7tkJYml428

Might show projectMouse(...) implementation as an example:

public Coord3d projectMouse(int x, int y) {
    GL2 gl = getCurrentGL();
    Coord3d p = cam.screenToModel(gl, glu, new Coord3d((float) x, (float) y, 0));
    getCurrentContext().release();
    return p;
}

How to use jzy3d in SWT?

I am a Chinese college student of computer science who love JAVA programming , but my English is so poor that i cannot understand the API.

Could you give me a demo about SWT how to use Jzy3d . If my words there is an error please understand me.

Delaunay stay in an infinite loop for the attached dataset

Although usually working good, delaunay algorithm hangs with the console message:
Warning, ajTriangle(A,B,C) expects points in counterclockwise order.
Point [x=17449.85546875, y=0.43204736709594727, z=52.999969482421875]Point [x=15847.58984375, y=0.40541332960128784, z=52.999977111816406]Point [x=9358.6005859375, y=0.29754865169525146, z=53.00000762939453]

Source dataset stand at end of issue.

Delaunay's implementation stand in https://github.com/jzy3d/jzy3d-api/tree/master/jzy3d-jdt-core


package org.jzy3d.issues.issue15;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.jzy3d.analysis.AbstractAnalysis;
import org.jzy3d.analysis.AnalysisLauncher;
import org.jzy3d.chart.Chart;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ColorMapper;
import org.jzy3d.colors.colormaps.ColorMapRainbow;
import org.jzy3d.maths.Coord3d;
import org.jzy3d.plot3d.builder.delaunay.DelaunayTessellatorV2;
import org.jzy3d.plot3d.primitives.Shape;
import org.jzy3d.plot3d.rendering.canvas.Quality;

public class DelaunayTest extends AbstractAnalysis {
public static void main(String[] args) throws Exception {
AnalysisLauncher.open(new DelaunayTest());
}

@Override
public void init() throws IOException {
    List<Coord3d> coords = getSurf();

    DelaunayTessellatorV2 tesselator = new DelaunayTessellatorV2();
    final Shape surface = (Shape)tesselator.build(coords);
    surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
    surface.setFaceDisplayed(true);
    surface.setWireframeDisplayed(true);
    surface.setWireframeColor(Color.BLACK);

    chart = new Chart(Quality.Advanced, getCanvasType());
    chart.getScene().getGraph().add(surface);
}

public List<Coord3d> getSurf() throws IOException {
    File testFile = new File("testPoints.csv");
    System.out.println(testFile.getAbsolutePath());

    BufferedReader reader = new BufferedReader(new FileReader("data/issue15.csv"));

    List<Coord3d> coords = new ArrayList<Coord3d>();

    String line = null;
    while ((line = reader.readLine()) != null) {
        String[] values = line.split(", ");
        assert (values.length == 3);
        Double aVal = Double.parseDouble(values[0]);
        Double bVal = Double.parseDouble(values[1]);
        Double cVal = Double.parseDouble(values[2]);
        coords.add(new Coord3d(aVal, bVal, cVal));
    }
    reader.close();
    return coords;
}

}


data/issues.csv

7161.0483, 0.30963045, 151.00002
16255.689, 0.48511374, 199.99998
9131.444, 0.298237, 62.00001
13330.93, 0.42806372, 183.0
13717.669, 0.39729, 107.999985
9571.9795, 0.36061943, 173.00002
17343.656, 0.4327622, 57.99997
6057.7993, 0.3061724, 181.00002
5594.6025, 0.29698473, 178.00002
14249.807, 0.40911177, 113.999985
14637.931, 0.44185314, 167.00002
13768.088, 0.4323543, 177.0
15791.425, 0.40745592, 58.999977
13684.161, 0.4309592, 177.0
9536.3545, 0.32629707, 105.00001
5962.716, 0.30459186, 181.00002
5973.0747, 0.30426803, 180.00002
9488.609, 0.32451135, 103.0
16533.953, 0.45104876, 122.0
7026.6133, 0.30441958, 145.0
7387.569, 0.2970268, 118.000015
13783.514, 0.39739245, 105.999985
9094.304, 0.35416722, 176.00003
5741.862, 0.29893655, 177.00002
17380.959, 0.4725688, 137.0
13739.271, 0.4026094, 117.99998
7224.8184, 0.2953135, 120.000015
5731.4233, 0.30025113, 180.00002
17195.875, 0.4694922, 137.0
9296.218, 0.30544025, 71.00001
14859.228, 0.4455317, 167.0
17449.855, 0.43204737, 52.99997
9597.583, 0.3263228, 103.00001
5367.045, 0.30560288, 203.0
6803.886, 0.30815774, 160.0
16513.312, 0.4526898, 125.99999
17536.574, 0.43348885, 52.99997
7285.669, 0.2973171, 122.000015
15847.59, 0.40541333, 52.999977
7305.12, 0.29664835, 120.000015
9464.553, 0.3280797, 111.00001
9324.872, 0.32476577, 109.00001
9017.249, 0.3533824, 177.00002
13190.681, 0.42474034, 181.0
6780.183, 0.31123593, 167.0
9181.413, 0.35611126, 177.00003
7605.19, 0.30362046, 124.00002
8898.659, 0.3355381, 145.0
16808.873, 0.48934886, 190.0
16706.693, 0.4559043, 126.0
8485.048, 0.35693657, 202.00003
9385.696, 0.32280064, 103.00001
7032.556, 0.30997473, 156.00002
13538.433, 0.42804077, 176.0
8731.88, 0.36550388, 211.00003
16141.964, 0.494136, 221.99998
7365.892, 0.30361092, 132.00002
6847.507, 0.3054106, 153.00002
17492.932, 0.47443008, 137.0
7460.233, 0.29922673, 120.000015
11913.204, 0.37225518, 117.99999
6958.781, 0.30329204, 145.0
11755.889, 0.36914414, 116.99999
9213.817, 0.32440785, 112.00001
8410.88, 0.360664, 212.00002
16614.426, 0.45238644, 122.0
13450.875, 0.42856944, 180.0
16287.485, 0.48564228, 200.0
9404.828, 0.30625358, 69.00001
17024.838, 0.4929388, 190.0
16978.607, 0.4921703, 190.0
9102.313, 0.3572766, 182.00003
9812.29, 0.364118, 172.00002
8548.596, 0.35848895, 203.00003
13805.789, 0.39627463, 102.99998
7507.1665, 0.29802278, 116.000015
8843.137, 0.35396042, 184.00003
5907.287, 0.30317447, 180.00002
5758.3403, 0.2997065, 178.00002
14927.74, 0.44667056, 167.0
9572.025, 0.30159238, 54.00001
10065.506, 0.3440216, 123.00004
13410.181, 0.42838904, 181.0
9195.894, 0.32063767, 105.00001
8886.632, 0.36758024, 210.00003
17353.852, 0.4721182, 137.0
13622.225, 0.43141773, 180.0
13905.241, 0.40338415, 113.999985
11114.987, 0.333193, 66.0
9358.601, 0.29754865, 53.000008
7012.961, 0.30369663, 144.0
7014.125, 0.30470803, 146.0
5783.135, 0.29863054, 175.00002
16718.389, 0.45461062, 123.0
5694.3413, 0.29864264, 178.00002
6464.2197, 0.30300757, 161.0
7456.811, 0.30413017, 130.00002
9761.314, 0.36376667, 173.00002
13676.086, 0.431321, 178.0
8922.619, 0.3349443, 143.0
5971.3345, 0.29927877, 170.00002
9314.405, 0.32260767, 105.00001
9506.423, 0.35704952, 168.00002
8806.123, 0.34094435, 159.0
7610.411, 0.30172312, 120.000015
9328.566, 0.35954943, 179.00003
16856.064, 0.49013332, 190.0
8944.172, 0.3685367, 210.00003
7655.6064, 0.3029704, 121.00002
11374.295, 0.33055896, 52.0

Add repository to pom file for SWT dependency.

The SWT jar files listed as a dependency are actually not deployed in Maven Central so you need to add the following repository to the pom.xml file:

swt-repo https://swt-repo.googlecode.com/svn/repo/

Otherwise, you're going to get an error message like the following when trying to build the project:

Failure to find org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.2.1

Get a BufferedImage

Hello, I am trying to use this library in conjunction with the IScala notebook.

The notebook is able to display images inline, provided one can create an instance of java.awt.image.BufferedImage.

I have been trying to produce a 3d scatter plot, but until now I had no success. I can easily produce a org.jzy3d.chart.Chart, say doing something like

val points = Array(
  new Coord3d(0, 0, 0),
  new Coord3d(0, 1, 1)
)
val colors = Array(
  new Color(1.0f, 1.0f, 0.0f, 1.0f),
  new Color(0.0f, 1.0f, 1.0f, 0.5f)
)
val scatter = new Scatter(points, colors)
val chart = AWTChartComponentFactory.chart(Quality.Advanced, "newt")
chart.getScene().add(scatter)

Unfortunately, I have not been able to render this chart to a BufferedImage. I have tried using an AWTRenderer3d, like this

val renderer = new AWTRenderer3d(chart.getView)
val buff = renderer.getLastScreenshotImage

but buff here is null. It seems I should call the method display on the renderer before getting the image, but this requires a GLAutoDrawable, and this is where I get lost.

Is there a simple way to obtain a buffered image from a chart?

Project mouse 2d to 3d give wrong result (Retina Display problem)

Initial discussion started here :
https://groups.google.com/forum/#!topic/jzy3d/aY29bz-OxMA

I Confirm problems related to mouse and projection that probably appeared with version 1.0.0-SNAPSHOT.

Although awt mouse event have appropriate coordinates in awt MouseEvent, I noticed all programs involving selection are displaying mouse at half its X/Y position.

HACKYFIX : Multiplying all mouse events by 2 for me fixes the problem but this is not the good way to fix it.

The method performing 2D->3D conversion (Camera.screenToModel) is using a viewport that has suspect value :

  • for a chart sized to 600 x 600, values returned by Camera.getViewPortAsInt() are 1200 x 1156.
  • if I fullscreen the chart with a MacOSX(Retina) configuration of 1680 x 1050, values returned by Camera.getViewPortAsInt() are 3360 x 1852

`
protected int[] getViewPortAsInt(GL gl) {

    int viewport[] = new int[4];

    gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);

    return viewport;
}

`

I still don't know if viewport has a good reason to have different sizes than the GL canvas.

Using multiple chart instance seams to lead to memory leaks (?)

JOGL warnings say:

X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 54/54, reusable (open, marked uncloseable): 0, pending (open in creation order): 54)
X11Util: Open X11 Display Connections: 54
X11Util: Open[0]: NamedX11Display[:0.0, 0x7ccff2c8, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0.0, 0xffffffffb76f4cf8, refCount 1, unCloseable false]
X11Util: Open[2]: NamedX11Display[:0.0, 0x790ff1b8, refCount 1, unCloseable false]
X11Util: Open[3]: NamedX11Display[:0.0, 0x78dff1b8, refCount 1, unCloseable false]
X11Util: Open[4]: NamedX11Display[:0.0, 0x77fff1e8, refCount 1, unCloseable false]
X11Util: Open[5]: NamedX11Display[:0.0, 0x770f6518, refCount 1, unCloseable false]
X11Util: Open[6]: NamedX11Display[:0.0, 0x77f12e60, refCount 1, unCloseable false]
///

DependencyResolutionException

Hello

I downloaded the repo and ran mvn install to get this error:

[ERROR] Failed to execute goal on project jzy3d-swt: Could not resolve dependencies for project org.jzy3d:jzy3d-swt:jar:1.0.0-SNAPSHOT: Failure to find org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.2.1 in https://swt-repo.googlecode.com/svn/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of swt-repo has elapsed or updates are forced -> [Help 1]

Please help

Thanks

Why do I have a blank canvas when trying to render using jzy3d v0.9.1 on Ubuntu 15.10?

I posted this issue on stackoverflow. The trouble is I'm not able to run jzy3d-0.9.1 on Ubuntu 15.10 or 12.04.

I get this error, when the running the sample code:

Info: Nativewindow X11 Error: 2 - BadValue (integer parameter out of range for operation), dpy 0x7feed88b0d10, id 0, # 194: 12:0 X_ConfigureWindow

and this when I close the test dialog,

X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 3/3, reusable (open, marked uncloseable): 0, pending (open in creation order): 3)
X11Util: Open X11 Display Connections: 3
X11Util: Open[0]: NamedX11Display[:0, 0x7fd5acb420e0, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0, 0x7fd548003250, refCount 1, unCloseable false]
X11Util: Open[2]: NamedX11Display[:0, 0x7fd54800f460, refCount 1, unCloseable false]

NewtCameraMouseController cannot be cast to java.awt.event.MouseListener

I'm attempting to get the mouse controller working with a jzy3d swing window embedded into a javafx application. I get the exception
exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: org.jzy3d.chart.controllers.mouse.camera.NewtCameraMouseController cannot be cast to java.awt.event.MouseListener

Having a similar issue trying to embed it into a swing application in a tabpane.
The awt window works but naturally brings other issues with it.
I'm using javafx 2 with java 8 and netbeans 8, and jzy3d 0.91, and i've tried 0.92
create javafx application
add tabpane
and javafx chart to first tab
add jzy3d to second chart using SwingNode

Source below
/*

  • Copyright (c) 2008, 2012 Oracle and/or its affiliates.

  • All rights reserved. Use is subject to license terms.

    Edited by abaddon01
    */
    package chartadvancedbar;

import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.embed.swing.SwingNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import org.jzy3d.chart.Chart;
import org.jzy3d.chart.controllers.mouse.camera.NewtCameraMouseController;
import org.jzy3d.chart.controllers.thread.camera.CameraThreadController;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ColorMapper;
import org.jzy3d.colors.colormaps.ColorMapRainbow;
import org.jzy3d.maths.Range;
import org.jzy3d.plot3d.builder.Builder;
import org.jzy3d.plot3d.builder.Mapper;
import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
import org.jzy3d.plot3d.primitives.Shape;
import org.jzy3d.plot3d.rendering.canvas.Quality;

/**
*

  • An advanced bar chart with a variety of controls.
    *

  • @see javafx.scene.chart.BarChart

  • @see javafx.scene.chart.Chart

  • @see javafx.scene.chart.NumberAxis

  • @see javafx.scene.chart.XYChart
    */
    public class ChartAdvancedBar extends Application {

    private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    root.getChildren().add(createTabPane());
    }

    public Node createTabPane() {
    TabPane tabs = new TabPane();
    Tab barChartTab = new Tab("BarChart");
    barChartTab.setContent(createChart());
    tabs.getTabs().add(barChartTab);
    Tab jzy3dTab = new Tab("JZY3D");
    jzy3dTab.setContent(createJZY3DDemo());
    tabs.getTabs().add(jzy3dTab);
    return tabs;
    }

    private Node createJZY3DDemo() {
    StackPane pane = new StackPane();
    SwingNode swingNode = new SwingNode();

    createSwingContent(swingNode);
    pane.getChildren().add(swingNode);
    return pane;
    

    }

    private void createSwingContent(final SwingNode swingNode) {
    final SurfaceDemo sd = new SurfaceDemo();
    SwingUtilities.invokeLater(new Runnable() {
    @OverRide
    public void run() {
    swingNode.setContent(sd.getComponent());
    }
    });
    }

    protected BarChart<String, Number> createChart() {
    final String[] years = {"2007", "2008", "2009"};
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis, "$", null));
    final BarChart<String, Number> bc = new BarChart<>(xAxis, yAxis);
    // setup chart
    bc.setTitle("Advanced Bar Chart");
    xAxis.setLabel("Year");
    xAxis.setCategories(FXCollections.observableArrayList(Arrays.asList(years)));
    yAxis.setLabel("Price");
    // add starting data
    XYChart.Series<String, Number> series1 = new XYChart.Series<>();
    series1.setName("Data Series 1");
    // create sample data
    series1.getData().add(new XYChart.Data<String, Number>(years[0], 567));
    series1.getData().add(new XYChart.Data<String, Number>(years[1], 1292));
    bc.getData().add(series1);
    return bc;
    }

    @OverRide
    public void start(Stage primaryStage) throws Exception {
    init(primaryStage);
    primaryStage.show();
    }

    /**

    • The main() method is ignored in correctly deployed JavaFX application.
    • main() serves only as fallback in case the application can not be
    • launched through deployment artifacts, e.g., in IDEs with limited FX
    • support. NetBeans ignores main().
      *
    • @param args the command line arguments
      */
      public static void main(String[] args) {
      launch(args);
      }
      }

class SurfaceDemo {

private Chart chart;

public String getCanvasType() {
    return "swing";
}

public JComponent getComponent() {

    //cmc.
    init();
    System.out.println("init");
    NewtCameraMouseController cmc = new NewtCameraMouseController(chart);
    CameraThreadController cmt = new CameraThreadController(chart);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add((Component) chart.getCanvas(), BorderLayout.CENTER);

    return panel;
}

public void init() {
    // Define a function to plot
    Mapper mapper = new Mapper() {
        public double f(double x, double y) {
            return x * Math.sin(x * y);
        }
    };
    // Define range and precision for the function to plot
    Range range = new Range(-3, 3);
    int steps = 80;

    // Create the object to represent the function over the given range.
    final Shape surface = Builder.buildOrthonormal(new OrthonormalGrid(range, steps, range, steps), mapper);
    surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
    surface.setFaceDisplayed(true);
    surface.setWireframeDisplayed(false);

    // Create a chart
    chart = org.jzy3d.chart.factories.SwingChartComponentFactory.chart(Quality.Advanced, getCanvasType());
    chart.getScene().getGraph().add(surface);
}

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.