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
FieldsModifier and TypeFieldDescriptionprotected LabelOrientationprotected LabelOrientationprotected LabelOrientationprotected ICanvasprotected ArrayList<AbstractCameraController>static final Qualityprotected IChartFactoryprotected booleanprotected booleanprotected ICameraKeyControllerprotected Lightprotected Light[]protected static final intprotected static final intprotected static final intprotected static org.apache.logging.log4j.Loggerprotected ICameraMouseControllerprotected IMousePickingControllerprotected Coord3dprotected Coord3dprotected Coord3dprotected Qualityprotected Sceneprotected IScreenshotKeyControllerprotected Viewprotected Coord3dprotected ViewportModeprotected ViewPositionMode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Collection<Serie2d> series) Add a list of drawables and refresh the view of the scene once they are all added.voidvoidAdd 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.ONto most good looking rendering.voidaddController(AbstractCameraController controller) Add aAbstractCameraControllerto thisChart.Deprecated.Add a light at the given position, using theLight.DEFAULT_COLORfor 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_COLORfor 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 voidprotected voidSwitch between on demand/continuous rendering keep to false if animated to avoid double rendering keep to true otherwise the mouse does not updateprotected voidSwitch between on demand/continuous rendering keep to false if animated to avoid double rendering keep to true otherwise the mouse does not updatevoiddispose()floatflip(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 MouseEventmouseEvent(Component sourceCanvas, int x, int y) newView()open()open(int width, int height) Open the frame if it was not opened beforevoidvoidvoidvoidvoidremoveController(AbstractCameraController controller) removeSerie(String name, Serie2d.Type type) voidrender()Trigger a chart rendering.voidrender(int n) voidscreenshot(File file) Compute screenshot and save to filevoidsetAnimated(boolean status) voidsetAxeDisplayed(boolean status) voidsetQuality(Quality quality) voidvoidvoidsetViewMode(ViewPositionMode mode) voidsetViewPoint(Coord3d viewPoint) Alias forinvalid @link
display()voidsleep(int mili) A one liner to wait a bit, mainly for test purpose, when needing to have a frame opened and a chart initializedvoidvoidvoidprotected voidprotected voidprotected voidprotected voidvoidview()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 aAbstractCameraControllerto thisChart. Warning: theChartis 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 calling}invalid @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.ONto 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 configuredas shown belowinvalid @link
AdaptiveMouseControllerchart.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. AllLODSettingare ranked in aLODCandidatesinstance 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_COLORfor 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. SeeLightdocumentation 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_COLORfor 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. SeeLightdocumentation 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
-