Package org.jzy3d.chart
Class Chart
java.lang.Object
org.jzy3d.chart.Chart
- Direct Known Subclasses:
AWTChart
,GraphChart
,SWTChart
Chart
is a convenient object that gather all components required to render a 3d scene for
plotting.- Author:
- Martin Pernollet
-
Field Summary
Modifier and TypeFieldDescriptionprotected LabelOrientation
protected LabelOrientation
protected LabelOrientation
protected ICanvas
protected ArrayList<AbstractCameraController>
static final Quality
protected IChartFactory
protected boolean
protected boolean
protected ICameraKeyController
protected Light
protected Light[]
protected static final int
protected static final int
protected static final int
protected static org.apache.logging.log4j.Logger
protected ICameraMouseController
protected IMousePickingController
protected Coord3d
protected Coord3d
protected Coord3d
protected Quality
protected Scene
protected IScreenshotKeyController
protected View
protected Coord3d
protected ViewportMode
protected ViewPositionMode
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Collection<Serie2d> series) Add a list of drawables and refresh the view of the scene once they are all added.void
void
Add a drawable and refresh the view of the scene once it is added.Add a drawable to the scene graph of the chart.add
(Drawable drawable, LODCandidates candidates) Add a drawable by first evaluating its rendering performance onscreen from worse (LODSetting.Bounds.ON
to most good looking rendering.void
addController
(AbstractCameraController controller) Add aAbstractCameraController
to thisChart
.Deprecated.Add a light at the given position, using theLight.DEFAULT_COLOR
for the three coloring settings.Add a light at the given position.Add a light at the given position.Add a light that is attached to camera, which is moved as soon as the viewpoint changes, using theLight.DEFAULT_COLOR
for the three coloring settings.addLightOnCamera
(Color colorForAll) addLightOnCamera
(Color ambiant, Color diffuse, Color specular) Add a light that is attached to camera, which is moved as soon as the viewpoint changes.Light[]
Light[]
addLightPairOnCamera
(Color colorForAll) Light[]
addLightPairOnCamera
(Color ambiant, Color diffuse, Color specular) Add a light pair syncronized to camera.addMouse()
Deprecated.addMousePickingController
(int clickWidth) black()
protected void
protected void
Switch between on demand/continuous rendering keep to false if animated to avoid double rendering keep to true otherwise the mouse does not updateprotected void
Switch between on demand/continuous rendering keep to false if animated to avoid double rendering keep to true otherwise the mouse does not updatevoid
dispose()
float
flip
(float y) Return the first available colorbar in the view layout, or null if none was createdgetMouse()
getScale()
getScene()
getSerie
(String name, Serie2d.Type type) getView()
protected static MouseEvent
mouseEvent
(Component sourceCanvas, int x, int y) newView()
open()
open
(int width, int height) Open the frame if it was not opened beforevoid
void
void
void
void
removeController
(AbstractCameraController controller) removeSerie
(String name, Serie2d.Type type) void
render()
Trigger a chart rendering.void
render
(int n) void
screenshot
(File file) Compute screenshot and save to filevoid
setAnimated
(boolean status) void
setAxeDisplayed
(boolean status) void
setQuality
(Quality quality) void
void
void
setViewMode
(ViewPositionMode mode) void
setViewPoint
(Coord3d viewPoint) Alias forinvalid @link
display()
void
sleep
(int mili) A one liner to wait a bit, mainly for test purpose, when needing to have a frame opened and a chart initializedvoid
void
void
protected void
protected void
protected void
protected void
void
view()
view2d()
Toggle the chart for 2D rendering.view3d()
white()
-
Field Details
-
logger
protected static org.apache.logging.log4j.Logger logger -
DEFAULT_QUALITY
-
LOD_BOUNDS_ONLY_RENDER_TIME_MS
protected static final int LOD_BOUNDS_ONLY_RENDER_TIME_MS- See Also:
-
LOD_EVAL_TRIALS
protected static final int LOD_EVAL_TRIALS- See Also:
-
LOD_EVAL_MAX_EVAL_DURATION_MS
protected static final int LOD_EVAL_MAX_EVAL_DURATION_MS- See Also:
-
factory
-
quality
-
scene
-
view
-
canvas
-
previousViewPointFree
-
previousViewPointTop
-
previousViewPointProfile
-
controllers
-
mouse
-
mousePicking
-
keyboard
-
screenshotKey
-
lightOnCamera
-
lightPairOnCamera
-
series
-
axisXLabelOrientation
-
axisYLabelOrientation
-
axisZLabelOrientation
-
isTickLineDisplayed
protected boolean isTickLineDisplayed -
isSquaredViewActive
protected boolean isSquaredViewActive -
viewPositionMode
-
viewportMode
-
viewpoint
-
-
Constructor Details
-
Chart
-
Chart
protected Chart()
-
-
Method Details
-
black
-
white
-
color
-
view2d
Toggle the chart for 2D rendering. Warning : when using 2D rendering, one should not try to set a squared view to avoid messing a tick and axis labels. -
view2d
-
view3d
-
show
Alias forinvalid @link
display()
-
display
-
dispose
public void dispose() -
render
public void render()Trigger a chart rendering. Only usefull if chart Quality.is -
render
public void render(int n) -
setAnimated
public void setAnimated(boolean status) -
updateAnimationThreadWithQualitySettings
protected void updateAnimationThreadWithQualitySettings() -
startAnimation
public void startAnimation() -
stopAnimation
public void stopAnimation() -
stopAllThreads
public void stopAllThreads() -
screenshot
Compute screenshot and save to file- Throws:
IOException
-
screenshot
-
updateProjectionsAndRender
public void updateProjectionsAndRender() -
newView
-
addMouseCameraController
Deprecated.useaddMouse()
instead. -
addMouse
-
configureMouseWithAnimator
protected void configureMouseWithAnimator()Switch between on demand/continuous rendering keep to false if animated to avoid double rendering keep to true otherwise the mouse does not update -
addMousePickingController
-
addKeyboardCameraController
Deprecated.useaddKeyboard()
instead. -
addKeyboard
-
configureKeyboardWithAnimator
protected void configureKeyboardWithAnimator()Switch between on demand/continuous rendering keep to false if animated to avoid double rendering keep to true otherwise the mouse does not update -
addKeyboardScreenshotController
-
getMouse
-
getThread
-
getMousePicking
-
getKeyboard
-
getScreenshotKey
-
addController
Add aAbstractCameraController
to thisChart
. Warning: theChart
is not the owner of the controller. Disposing the chart thus just unregisters the controllers, but does not handle stopping and disposing controllers. -
removeController
-
clearControllerList
protected void clearControllerList() -
open
-
open
-
open
-
open
-
sleep
public void sleep(int mili) A one liner to wait a bit, mainly for test purpose, when needing to have a frame opened and a chart initialized -
open
Open the frame if it was not opened before- Parameters:
title
-rect
-- Returns:
-
add
Add a list of drawables and refresh the view of the scene once they are all added.- Parameters:
drawables
-- Returns:
-
add
Add a drawable and refresh the view of the scene once it is added.- Parameters:
drawable
-- Returns:
-
add
Add a drawable to the scene graph of the chart. If the view holds aSpaceTransformer
, then it will be applied to the drawable. This can be reset by later callinginvalid @link
{@link Drawable#setSpaceTransformer(null)
- Parameters:
drawable
-updateView
- states if the view should be updated immediately. Should be false if adding multiple drawable at the same time. The effect of not updating view is that view bounds won't be updated as well- Returns:
-
add
Add a drawable by first evaluating its rendering performance onscreen from worse (LODSetting.Bounds.ON
to most good looking rendering. This method is useful when using facing low performance rendering, e.g. because one chose the fallback EmulGL renderer over native.Using dynamic level of details
This requires to have a properly configuredinvalid @link
AdaptiveMouseController
chart.add(myDrawable, new LODCandidates()); AdaptiveRenderingPolicy policy = new AdaptiveRenderingPolicy(); policy.optimizeForRenderingTimeLargerThan = 80;// ms policy.optimizeByPerformanceKnowledge = true; EmulGLSkin skin = EmulGLSkin.on(chart); skin.getMouse().setPolicy(policy);
Algorithm
Each Level of Detail configuration is described by aLODSetting
. AllLODSetting
are ranked in aLODCandidates
instance that indicates which are the most good looking settings. We define the best with lowest ID, the worse with highest ID.Training
LOD are evaluated in reverse order, as soon as the drawable is added to the chart. Evaluation store a rendering time for eachLODSetting
- LOD 3 took 40ms
- LOD 2 took 60ms
- LOD 1 took 80ms
- LOD 0 took 100ms
Applying
As soon as the mouse start dragging camera, the mouse controller will seek an acceptable LOD to reach the target- LOD 0 took 100ms // rejected
- LOD 1 took 80ms // rejected
- LOD 2 took 60ms // selected
- LOD 3 took 40ms // ignored
- LOD 0 took 100ms // rejected
- LOD 1 took 80ms // rejected
- LOD 2 took 60ms // rejected
- LOD 3 took 40ms // selected : minimal rendering time above threshold
- Parameters:
drawable
-- Returns:
-
mouseEvent
-
add
-
add
-
add
-
getSerie
-
removeSerie
-
remove
-
remove
-
remove
-
remove
-
addLight
Add a light at the given position, using theLight.DEFAULT_COLOR
for the three coloring settings. Warning : The default color being white, any polygon in pure RED, pure GREEN or pure BLUE will have the exact same color when using a light. SeeLight
documentation for this, or change the light color or object color a bit. -
addLight
Add a light at the given position.- Parameters:
ambiant
-diffuse
-specular
-- Returns:
-
addLight
-
addLight
Add a light at the given position.- Parameters:
ambiant
-diffuse
-specular
-- Returns:
-
addLightOnCamera
Add a light that is attached to camera, which is moved as soon as the viewpoint changes, using theLight.DEFAULT_COLOR
for the three coloring settings. Warning : The default color being white, any polygon in pure RED, pure GREEN or pure BLUE will have the exact same color when using a light. SeeLight
documentation for this, or change the light color or object color a bit. -
addLightOnCamera
-
addLightOnCamera
Add a light that is attached to camera, which is moved as soon as the viewpoint changes. If this light was already created, the initial instance is returned, even if the color setting do not match.- Parameters:
ambiant
-diffuse
-specular
-- Returns:
-
updateLightOnCameraPosition
protected void updateLightOnCameraPosition() -
addLightPairOnCamera
-
addLightPairOnCamera
-
addLightPairOnCamera
Add a light pair syncronized to camera. Top light is 45° above the camera, bottom light is 45° below the camera. If these lights were already created, the initial instances are returned, even if the color setting do not match.- Parameters:
ambiant
-diffuse
-specular
-- Returns:
-
updateLightPairOnCameraPosition
protected void updateLightPairOnCameraPosition() -
updateLightsOnCameraPositions
protected void updateLightsOnCameraPositions() -
setAxeDisplayed
public void setAxeDisplayed(boolean status) -
setViewPoint
-
getViewPoint
-
getViewMode
-
setScale
-
setScale
-
getScale
-
getPainter
-
setViewMode
-
flip
public float flip(float y) -
view
-
getView
-
getScene
-
getCanvas
-
getAxisLayout
-
getFactory
-
getControllers
-
getQuality
-
setQuality
-
getColorbar
Return the first available colorbar in the view layout, or null if none was created -
getLegends
-