├── .github └── workflows │ └── ci.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── contributors.txt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src ├── main ├── java │ ├── eu │ │ └── hansolo │ │ │ └── fx │ │ │ ├── charts │ │ │ ├── ArcChart.java │ │ │ ├── ArcChartBuilder.java │ │ │ ├── Axis.java │ │ │ ├── AxisBuilder.java │ │ │ ├── AxisType.java │ │ │ ├── BubbleGridChart.java │ │ │ ├── BubbleGridChartBuilder.java │ │ │ ├── Category.java │ │ │ ├── ChartArea.java │ │ │ ├── ChartType.java │ │ │ ├── CircularPlot.java │ │ │ ├── CircularPlotBuilder.java │ │ │ ├── Cluster.java │ │ │ ├── ComparisonRingChart.java │ │ │ ├── ComparisonRingChartBuilder.java │ │ │ ├── ConcentricRingChart.java │ │ │ ├── ConcentricRingChartBuilder.java │ │ │ ├── CoxcombChart.java │ │ │ ├── CoxcombChartBuilder.java │ │ │ ├── Demo.java │ │ │ ├── Grid.java │ │ │ ├── GridBuilder.java │ │ │ ├── Launcher.java │ │ │ ├── Legend.java │ │ │ ├── LegendItem.java │ │ │ ├── MatrixPane.java │ │ │ ├── NestedBarChart.java │ │ │ ├── NestedBarChartBuilder.java │ │ │ ├── ParallelCoordinatesChart.java │ │ │ ├── ParallelCoordinatesChartBuilder.java │ │ │ ├── PixelMatrix.java │ │ │ ├── PixelMatrixBuilder.java │ │ │ ├── PolarChart.java │ │ │ ├── PolarTickStep.java │ │ │ ├── Position.java │ │ │ ├── SankeyPlot.java │ │ │ ├── SankeyPlotBuilder.java │ │ │ ├── SectorChart.java │ │ │ ├── SectorChartBuilder.java │ │ │ ├── StreamChart.java │ │ │ ├── StreamChartBuilder.java │ │ │ ├── SunburstChart.java │ │ │ ├── SunburstChartBuilder.java │ │ │ ├── Symbol.java │ │ │ ├── TickLabelOrientation.java │ │ │ ├── XYChart.java │ │ │ ├── XYPane.java │ │ │ ├── XYZPane.java │ │ │ ├── YChart.java │ │ │ ├── YPane.java │ │ │ ├── areaheatmap │ │ │ │ ├── AreaHeatMap.java │ │ │ │ └── AreaHeatMapBuilder.java │ │ │ ├── color │ │ │ │ ├── Colors.java │ │ │ │ ├── FlatColors.java │ │ │ │ ├── FlatUIColors.java │ │ │ │ ├── MaterialDesignColors.java │ │ │ │ ├── MetroColors.java │ │ │ │ └── SocialColors.java │ │ │ ├── converter │ │ │ │ ├── Converter.java │ │ │ │ └── Unit.java │ │ │ ├── data │ │ │ │ ├── BubbleGridChartItem.java │ │ │ │ ├── BubbleGridChartItemBuilder.java │ │ │ │ ├── BubbleGridItem.java │ │ │ │ ├── ChartItem.java │ │ │ │ ├── ChartItemBuilder.java │ │ │ │ ├── Connection.java │ │ │ │ ├── DataObject.java │ │ │ │ ├── DataPoint.java │ │ │ │ ├── Item.java │ │ │ │ ├── MapConnection.java │ │ │ │ ├── MatrixChartItem.java │ │ │ │ ├── MatrixItem.java │ │ │ │ ├── Metadata.java │ │ │ │ ├── PlotItem.java │ │ │ │ ├── TYChartItem.java │ │ │ │ ├── TreeNode.java │ │ │ │ ├── ValueChartItem.java │ │ │ │ ├── ValueItem.java │ │ │ │ ├── WeightedMapPoints.java │ │ │ │ ├── XYChartItem.java │ │ │ │ ├── XYItem.java │ │ │ │ ├── XYZChartItem.java │ │ │ │ └── XYZItem.java │ │ │ ├── event │ │ │ │ ├── ChartEvent.java │ │ │ │ ├── ChartEventListener.java │ │ │ │ ├── ConnectionEvent.java │ │ │ │ ├── ConnectionEventListener.java │ │ │ │ ├── EventType.java │ │ │ │ ├── ItemEvent.java │ │ │ │ ├── ItemEventListener.java │ │ │ │ ├── LocationEvent.java │ │ │ │ ├── LocationEventListener.java │ │ │ │ ├── MapConnectionEvent.java │ │ │ │ ├── MapConnectionEventListener.java │ │ │ │ ├── PixelMatrixEvent.java │ │ │ │ ├── PixelMatrixEventListener.java │ │ │ │ ├── SelectionEvent.java │ │ │ │ ├── SelectionEventListener.java │ │ │ │ ├── SeriesEvent.java │ │ │ │ ├── SeriesEventListener.java │ │ │ │ ├── TreeNodeEvent.java │ │ │ │ ├── TreeNodeEventListener.java │ │ │ │ └── TreeNodeEventType.java │ │ │ ├── font │ │ │ │ └── Fonts.java │ │ │ ├── forcedirectedgraph │ │ │ │ ├── GraphCalculator.java │ │ │ │ ├── GraphEdge.java │ │ │ │ ├── GraphNode.java │ │ │ │ ├── GraphPanel.java │ │ │ │ ├── InfoPopup.java │ │ │ │ └── NodeEdgeModel.java │ │ │ ├── heatmap │ │ │ │ ├── HeatMap.java │ │ │ │ ├── HeatMapBuilder.java │ │ │ │ ├── HeatMapSpot.java │ │ │ │ └── OpacityDistribution.java │ │ │ ├── pareto │ │ │ │ ├── ParetoBar.java │ │ │ │ ├── ParetoInfoPopup.java │ │ │ │ ├── ParetoModel.java │ │ │ │ └── ParetoPanel.java │ │ │ ├── series │ │ │ │ ├── ChartItemSeries.java │ │ │ │ ├── ChartItemSeriesBuilder.java │ │ │ │ ├── MatrixItemSeries.java │ │ │ │ ├── MatrixItemSeriesBuilder.java │ │ │ │ ├── Series.java │ │ │ │ ├── XYSeries.java │ │ │ │ ├── XYSeriesBuilder.java │ │ │ │ ├── XYZSeries.java │ │ │ │ ├── XYZSeriesBuilder.java │ │ │ │ ├── YSeries.java │ │ │ │ └── YSeriesBuilder.java │ │ │ ├── tools │ │ │ │ ├── CatmullRom.java │ │ │ │ ├── ColorMapping.java │ │ │ │ ├── CtxBounds.java │ │ │ │ ├── CtxCornerRadii.java │ │ │ │ ├── CtxDimension.java │ │ │ │ ├── FontMetrix.java │ │ │ │ ├── GradientLookup.java │ │ │ │ ├── Helper.java │ │ │ │ ├── InfoPopup.java │ │ │ │ ├── Location.java │ │ │ │ ├── LocationBuilder.java │ │ │ │ ├── MapPoint.java │ │ │ │ ├── NumberFormat.java │ │ │ │ ├── Order.java │ │ │ │ ├── Pair.java │ │ │ │ ├── Point.java │ │ │ │ ├── ScaleDirection.java │ │ │ │ ├── SortDirection.java │ │ │ │ ├── Statistics.java │ │ │ │ ├── TickLabelFormat.java │ │ │ │ ├── TickLabelLocation.java │ │ │ │ ├── TickLabelOrientation.java │ │ │ │ ├── TooltipPopup.java │ │ │ │ └── Topic.java │ │ │ ├── voronoi │ │ │ │ ├── ArraySet.java │ │ │ │ ├── Graph.java │ │ │ │ ├── Triangle.java │ │ │ │ ├── Triangulation.java │ │ │ │ ├── VPoint.java │ │ │ │ ├── VoronoiChart.java │ │ │ │ └── VoronoiChartBuilder.java │ │ │ └── world │ │ │ │ ├── BusinessRegion.java │ │ │ │ ├── CRegion.java │ │ │ │ ├── Country.java │ │ │ │ ├── CountryPath.java │ │ │ │ ├── CountryRegion.java │ │ │ │ ├── ValueObject.java │ │ │ │ ├── World.java │ │ │ │ └── WorldBuilder.java │ │ │ └── geometry │ │ │ ├── BaseBounds.java │ │ │ ├── BezierCurve.java │ │ │ ├── BezierCurveIterator.java │ │ │ ├── Circle.java │ │ │ ├── Ellipse.java │ │ │ ├── EllipseIterator.java │ │ │ ├── FlatteningPathIterator.java │ │ │ ├── Line.java │ │ │ ├── LineIterator.java │ │ │ ├── Path.java │ │ │ ├── PathIterator.java │ │ │ ├── QuadCurve.java │ │ │ ├── QuadIterator.java │ │ │ ├── RectBounds.java │ │ │ ├── Rectangle.java │ │ │ ├── RectangularShape.java │ │ │ ├── Shape.java │ │ │ ├── tools │ │ │ ├── AbstractSegment.java │ │ │ ├── GradientLookup.java │ │ │ ├── Helper.java │ │ │ ├── IllegalPathStateException.java │ │ │ ├── NonInvertibleTransformException.java │ │ │ ├── PathTool.java │ │ │ ├── Point.java │ │ │ └── Segment.java │ │ │ └── transform │ │ │ ├── Affine.java │ │ │ ├── AffineBase.java │ │ │ ├── BaseTransform.java │ │ │ ├── Identity.java │ │ │ └── Translate.java │ └── module-info.java └── resources │ └── eu │ └── hansolo │ └── fx │ └── charts │ ├── chart.css │ ├── font │ ├── Lato-Bol.otf │ ├── Lato-Lig.otf │ ├── Lato-Reg.otf │ ├── OpenSans-Bold.ttf │ ├── OpenSans-ExtraBold.ttf │ ├── OpenSans-Light.ttf │ ├── OpenSans-Regular.ttf │ └── OpenSans-Semibold.ttf │ └── world │ ├── custom-styles.css │ ├── hires.properties │ ├── lores.properties │ └── world.css └── test ├── .gradle └── 3.3 │ └── taskArtifacts │ ├── fileHashes.bin │ ├── fileSnapshots.bin │ ├── taskArtifacts.bin │ └── taskArtifacts.lock ├── java └── eu │ └── hansolo │ └── fx │ └── charts │ ├── ArcChartTest.java │ ├── ArcChartTestLauncher.java │ ├── AreaHeatMapTest.java │ ├── AreaHeatMapTestLauncher.java │ ├── AxisTest.java │ ├── AxisTestLauncher.java │ ├── BubbleGridChartTest.java │ ├── BubbleGridChartTestLauncher.java │ ├── ChartTest.java │ ├── ChartTestLauncher.java │ ├── CircularPlotTest.java │ ├── CircularPlotTestLauncher.java │ ├── ComparisonRingChartTest.java │ ├── ComparisonRingChartTestLauncher.java │ ├── ConcentricRingChartTest.java │ ├── ConcentricRingChartTestLauncher.java │ ├── CoxcombChartTest.java │ ├── CoxcombChartTestLauncher.java │ ├── EmptyItemTest.java │ ├── EmptyItemTestLauncher.java │ ├── ForceDirectedGraphTest.java │ ├── ForceDirectedGraphTestLauncher.java │ ├── GridTest.java │ ├── GridTestLauncher.java │ ├── HeatMapTest.java │ ├── HeatMapTestLauncher.java │ ├── HorizonChartTest.java │ ├── HorizonChartTestLauncher.java │ ├── LegendTest.java │ ├── LegendTestLauncher.java │ ├── LineChartTest.java │ ├── LineChartTestLauncher.java │ ├── LogAxisTest.java │ ├── LogAxisTestLauncher.java │ ├── LogChartTest.java │ ├── LogChartTestLauncher.java │ ├── LogGridTest.java │ ├── LogGridTestLauncher.java │ ├── MatrixHeatmapTest.java │ ├── MatrixHeatmapTestLauncher.java │ ├── MatrixPlotTest.java │ ├── MatrixPlotTestLauncher.java │ ├── MultiTimeSeriesTest.java │ ├── MultiTimeSeriesTestLauncher.java │ ├── NestedBarChartTest.java │ ├── NestedBarChartTestLauncher.java │ ├── ParallelCoordinatesChartTest.java │ ├── ParallelCoordinatesChartTestLauncher.java │ ├── ParetoTest.java │ ├── ParetoTestLauncher.java │ ├── PlayfairTest.java │ ├── PlayfairTestLauncher.java │ ├── PolarChartTest.java │ ├── PolarChartTestLauncher.java │ ├── RadarChartTest.java │ ├── RadarChartTestLauncher.java │ ├── RidgeLineChartTest.java │ ├── RidgeLineChartTestLauncher.java │ ├── SankeyPlotTest.java │ ├── SankeyPlotTestLauncher.java │ ├── SectorChartTest.java │ ├── SectorChartTestLauncher.java │ ├── SingleChartTest.java │ ├── SingleChartTestLauncher.java │ ├── StreamChartTest.java │ ├── StreamChartTestLauncher.java │ ├── SunburstChartTest.java │ ├── SunburstChartTestLauncher.java │ ├── TimeAxisTest.java │ ├── TimeAxisTestLauncher.java │ ├── VoronoiChartTest.java │ ├── VoronoiChartTestLauncher.java │ ├── WorldHeatMapTest.java │ ├── WorldHeatMapTestLauncher.java │ ├── WorldmapConnectionsTest.java │ └── WorldmapConnectionsTestLauncher.java └── resources └── eu └── hansolo └── fx └── charts ├── cities.txt ├── data1.csv ├── data2.csv ├── data3.csv ├── plane.png └── tooltip.css /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Java CI 3 | 4 | on: [push] 5 | 6 | jobs: 7 | test: 8 | runs-on: ${{ matrix.os }} 9 | strategy: 10 | matrix: 11 | os: [ubuntu-18.04, macOS-latest, windows-latest] 12 | java: [11.0.14] 13 | fail-fast: false 14 | max-parallel: 4 15 | name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up JDK 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: ${{ matrix.java }} 23 | - name: Import GPG Key 24 | id: import_gpg 25 | uses: crazy-max/ghaction-import-gpg@v3 26 | with: 27 | gpg-private-key: ${{ secrets.GPG_KEY }} 28 | passphrase: ${{ secrets.GPG_PASSPHRASE }} 29 | env: 30 | GPG_PRIVATE_KEY: ${{ secrets.GPG_KEY }} 31 | PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 32 | - name: Build with Gradle 33 | run: ./gradlew clean build 34 | env: 35 | OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} 36 | OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} 37 | GH_USER: ${{ secrets.GH_USER }} 38 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 39 | GPG_PRIVATE_KEY: ${{ secrets.GPG_KEY }} 40 | PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 41 | - name: Upload artifact 42 | uses: actions/upload-artifact@v2 43 | with: 44 | name: Charts 45 | path: ./build/libs/** 46 | ... -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /.gradle 3 | .DS_Store 4 | /build 5 | /out 6 | /classes 7 | /bin/ 8 | /.classpath 9 | /.project 10 | -------------------------------------------------------------------------------- /contributors.txt: -------------------------------------------------------------------------------- 1 | Gerrit Grunwald 2 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017 by Gerrit Grunwald 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | sourceCompatibility = 11 18 | targetCompatibility = 11 19 | 20 | group = eu.hansolo.fx 21 | version = 11.12 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.gradle.enterprise' version '3.6.3' 3 | } 4 | 5 | rootProject.name = 'charts' 6 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/AxisType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public enum AxisType { 20 | LINEAR, LOGARITHMIC, TIME, TEXT 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/Category.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class Category { 20 | private final String name; 21 | 22 | public Category(final String name) { 23 | this.name = name; 24 | } 25 | 26 | public String getName() { return name; } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/ChartArea.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | import javafx.scene.paint.Paint; 20 | 21 | 22 | /** 23 | * Created by hansolo on 16.07.17. 24 | */ 25 | public interface ChartArea { 26 | 27 | Paint getChartBackground(); 28 | void setChartBackground(Paint paint); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/ChartType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public enum ChartType { 20 | SCATTER, LINE, SMOOTH_LINE, AREA, SMOOTH_AREA, BAR, BUBBLE, DONUT, RADAR_POLYGON, SMOOTH_RADAR_POLYGON, RADAR_SECTOR, 21 | POLAR, SMOOTH_POLAR, HORIZON, SMOOTHED_HORIZON, MATRIX_HEATMAP, LINE_DELTA, SMOOTH_LINE_DELTA, NESTED_BAR, PARALLEL_COORDINATES, 22 | RIDGE_LINE, MULTI_TIME_SERIES, SMOOTHED_MULTI_TIME_SERIES 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/Launcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class Launcher { 20 | public static void main(String[] args) { Demo.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/PolarTickStep.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public enum PolarTickStep { 20 | FIVE(5), FIFTEEN(15), FOURTY_FIVE(45), NINETY(90); 21 | 22 | private final double VALUE; 23 | 24 | PolarTickStep(final double VALUE) { 25 | this.VALUE = VALUE; 26 | } 27 | 28 | public double get() { return VALUE; } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/Position.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public enum Position { TOP, RIGHT, BOTTOM, LEFT, CENTER } 20 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/Symbol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public enum Symbol { 20 | NONE, CIRCLE, SQUARE, TRIANGLE, STAR, CROSS 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/TickLabelOrientation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public enum TickLabelOrientation { 20 | ORTHOGONAL, HORIZONTAL, TANGENT 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/color/Colors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.color; 18 | 19 | import javafx.scene.paint.Color; 20 | 21 | 22 | public interface Colors { 23 | 24 | /** 25 | * Returns the corresponding JavaFX color. 26 | * 27 | * @return the corresponding JavaFX color. 28 | */ 29 | public Color get(); 30 | 31 | /** 32 | * Returns a String expression from the color with the format: colorToRGB(12, 121, 15) 33 | * 34 | * @return the String expression. 35 | */ 36 | public String rgb(); 37 | 38 | /** 39 | * Returns a String expression from the color and opacity with the format: colorToRGBA(12, 121, 15, 0.5) 40 | * 41 | * @return the String expression. 42 | */ 43 | public String rgba(final double OPACITY); 44 | 45 | /** 46 | * Returns a String expression from the color with the format: #AB12CD 47 | * 48 | * @return the String expression. 49 | */ 50 | public String web(); 51 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/BubbleGridItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts.data; 20 | 21 | import javafx.beans.property.DoubleProperty; 22 | import javafx.beans.property.ObjectProperty; 23 | 24 | 25 | public interface BubbleGridItem extends Item { 26 | ChartItem getCategoryX(); 27 | void setCategoryX(final ChartItem categoryX); 28 | ObjectProperty categoryXProperty(); 29 | 30 | ChartItem getCategoryY(); 31 | void setCategoryY(final ChartItem categoryY); 32 | ObjectProperty categoryYProperty(); 33 | 34 | double getValue(); 35 | void setValue(final double value); 36 | DoubleProperty valueProperty(); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/DataObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.data; 18 | 19 | import javafx.scene.paint.Color; 20 | import javafx.scene.paint.Paint; 21 | 22 | import java.util.Map; 23 | 24 | 25 | public interface DataObject { 26 | String getName(); 27 | 28 | Paint getFill(); 29 | void setFill(final Paint FILL); 30 | 31 | Color getStroke(); 32 | void setStroke(final Color STROKE); 33 | 34 | Map getProperties(); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/DataPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.data; 18 | 19 | import eu.hansolo.fx.charts.tools.Point; 20 | 21 | 22 | public class DataPoint extends Point { 23 | private double value; 24 | 25 | 26 | // ******************** Constructors ************************************** 27 | public DataPoint() { 28 | this(0, 0, 0); 29 | } 30 | public DataPoint(final double X, final double Y) { 31 | this(X, Y, 0); 32 | } 33 | public DataPoint(final double X, final double Y, final double VALUE) { 34 | super(X, Y); 35 | value = VALUE; 36 | } 37 | 38 | 39 | // ******************** Methods ******************************************* 40 | public double getValue() { return value; } 41 | public void setValue(final double VALUE) { value = VALUE; } 42 | 43 | @Override public String toString() { 44 | return new StringBuilder().append("x: ").append(getX()).append(", y: ").append(getY()).append(", value: ").append(value).toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/Item.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.data; 18 | 19 | import eu.hansolo.fx.charts.Symbol; 20 | import javafx.scene.paint.Color; 21 | 22 | 23 | public interface Item { 24 | 25 | String getName(); 26 | 27 | Color getFill(); 28 | 29 | Color getStroke(); 30 | 31 | Symbol getSymbol(); 32 | void setSymbol(Symbol symbol); 33 | 34 | boolean isEmptyItem(); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/MatrixItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.data; 18 | 19 | import javafx.beans.property.DoubleProperty; 20 | import javafx.beans.property.IntegerProperty; 21 | 22 | 23 | public interface MatrixItem extends Item { 24 | 25 | int getX(); 26 | void setX(int x); 27 | IntegerProperty xProperty(); 28 | 29 | int getY(); 30 | void setY(int y); 31 | IntegerProperty yProperty(); 32 | 33 | double getZ(); 34 | void setZ(double value); 35 | DoubleProperty zProperty(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/Metadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2022 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts.data; 20 | 21 | public interface Metadata { } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/TYChartItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.data; 18 | 19 | import eu.hansolo.fx.charts.Symbol; 20 | import eu.hansolo.fx.charts.tools.Helper; 21 | import javafx.beans.property.ObjectProperty; 22 | import javafx.beans.property.ObjectPropertyBase; 23 | import javafx.scene.paint.Color; 24 | 25 | import java.time.LocalDateTime; 26 | 27 | 28 | public class TYChartItem extends XYChartItem { 29 | private LocalDateTime _t; 30 | private ObjectProperty t; 31 | 32 | 33 | // ******************** Constructors ********************************** 34 | public TYChartItem() { 35 | this(LocalDateTime.now(), 0, "", Color.RED, Symbol.NONE); 36 | } 37 | public TYChartItem(final LocalDateTime T, final double Y, final String NAME) { 38 | this(T, Y, NAME, Color.RED, Symbol.NONE); 39 | } 40 | public TYChartItem(final LocalDateTime T, final double Y, final String NAME, final Color COLOR) { 41 | this(T, Y, NAME, COLOR, Symbol.NONE); 42 | } 43 | public TYChartItem(final LocalDateTime T, final double Y, final String NAME, final Color FILL, final Symbol SYMBOL) { 44 | super(T.toEpochSecond(Helper.getZoneOffset()), Y, NAME, FILL, Color.TRANSPARENT, SYMBOL); 45 | _t = T; 46 | } 47 | 48 | 49 | // ******************** Methods *************************************** 50 | public LocalDateTime getT() { return null == t ? _t : t.get(); } 51 | public void setT(final LocalDateTime T) { 52 | if (null == t) { 53 | _t = T; 54 | super.setX(_t.toEpochSecond(Helper.getZoneOffset())); 55 | } else { 56 | t.set(T); 57 | } 58 | } 59 | public ObjectProperty tProperty() { 60 | if (null == t) { 61 | t = new ObjectPropertyBase(_t) { 62 | @Override protected void invalidated() { TYChartItem.super.setX(get().toEpochSecond(Helper.getZoneOffset())); } 63 | @Override public Object getBean() { return TYChartItem.this; } 64 | @Override public String getName() { return "t"; } 65 | }; 66 | _t = null; 67 | } 68 | return t; 69 | } 70 | 71 | 72 | @Override public String toString() { 73 | return new StringBuilder().append("{\n") 74 | .append(" \"name\":\"").append(getName()).append("\",\n") 75 | .append(" \"t\":").append(getT()).append(",\n") 76 | .append(" \"y\":").append(getY()).append(",\n") 77 | .append(" \"symbol\":\"").append(getSymbol().name()).append("\"\n") 78 | .append("}") 79 | .toString(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/ValueItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.data; 18 | 19 | import javafx.beans.property.DoubleProperty; 20 | 21 | 22 | public interface ValueItem extends Item { 23 | 24 | double getValue(); 25 | void setValue(double y); 26 | DoubleProperty valueProperty(); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/WeightedMapPoints.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.data; 18 | 19 | public enum WeightedMapPoints { 20 | NONE, INCOMING, OUTGOING; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/XYItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.data; 18 | 19 | 20 | import javafx.beans.property.DoubleProperty; 21 | import javafx.beans.property.StringProperty; 22 | 23 | 24 | /** 25 | * Created by hansolo on 17.07.17. 26 | */ 27 | public interface XYItem extends Item { 28 | 29 | double getX(); 30 | void setX(double x); 31 | DoubleProperty xProperty(); 32 | 33 | double getY(); 34 | void setY(double y); 35 | DoubleProperty yProperty(); 36 | 37 | String getTooltipText(); 38 | void setTooltipText(String text); 39 | StringProperty tooltipTextProperty(); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/data/XYZItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.data; 18 | 19 | import javafx.beans.property.DoubleProperty; 20 | 21 | 22 | public interface XYZItem extends Item { 23 | 24 | double getX(); 25 | void setX(double x); 26 | DoubleProperty xProperty(); 27 | 28 | double getY(); 29 | void setY(double y); 30 | DoubleProperty yProperty(); 31 | 32 | double getZ(); 33 | void setZ(double value); 34 | DoubleProperty zProperty(); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/ChartEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | public class ChartEvent { 20 | private final EventType TYPE; 21 | 22 | 23 | // ******************** Constructors ************************************** 24 | public ChartEvent(final EventType TYPE) { 25 | this.TYPE = TYPE; 26 | } 27 | 28 | 29 | // ******************** Methods ******************************************* 30 | public EventType getTYPE() { return TYPE; } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/ChartEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | @FunctionalInterface 20 | public interface ChartEventListener { 21 | void onChartEvent(final ChartEvent EVENT); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/ConnectionEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | 20 | import eu.hansolo.fx.charts.CircularPlot; 21 | import eu.hansolo.fx.charts.data.Connection; 22 | import javafx.scene.input.MouseEvent; 23 | 24 | 25 | public class ConnectionEvent { 26 | private final EventType TYPE; 27 | private final T CONNECTION; 28 | 29 | // (nullable) the orginal mouse event with additional information 30 | private final MouseEvent MOUSE_EVENT; 31 | 32 | // ******************** Constructors ************************************** 33 | public ConnectionEvent(final EventType TYPE) { 34 | this(null, TYPE, null); 35 | } 36 | public ConnectionEvent(final CircularPlot plot, final T CONNECTION) { 37 | this(CONNECTION, EventType.UPDATE, null); 38 | } 39 | public ConnectionEvent(final T CONNECTION, final EventType TYPE, final MouseEvent MOUSE_EVENT) { 40 | this.CONNECTION = CONNECTION; 41 | this.TYPE = TYPE; 42 | this.MOUSE_EVENT = MOUSE_EVENT; 43 | } 44 | 45 | // ******************** Methods ******************************************* 46 | public T getConnection() { return CONNECTION; } 47 | public EventType getEventType() { return TYPE; } 48 | public MouseEvent getMouseEvent() { return MOUSE_EVENT; } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/ConnectionEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | @FunctionalInterface 20 | public interface ConnectionEventListener { 21 | void onConnectionEvent(final ConnectionEvent EVENT); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/EventType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | public enum EventType { 20 | UPDATE, FINISHED, SELECTED, CONNECTION_SELECTED_FROM, CONNECTION_SELECTED_TO, CONNECTION_SELECTED, 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/ItemEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | import eu.hansolo.fx.charts.data.Item; 20 | import javafx.scene.input.MouseEvent; 21 | 22 | 23 | public class ItemEvent { 24 | private final EventType TYPE; 25 | private final T ITEM; 26 | private final T TARGET_ITEM; 27 | 28 | // (nullable) the orginal mouse event with additional information 29 | private final MouseEvent MOUSE_EVENT; 30 | 31 | 32 | // ******************** Constructors ************************************** 33 | public ItemEvent(final EventType TYPE) { 34 | this(null, null, TYPE, null); 35 | } 36 | public ItemEvent(final T ITEM) { 37 | this(ITEM, null, EventType.UPDATE, null); 38 | } 39 | public ItemEvent(final T ITEM, final EventType TYPE) { 40 | this(ITEM, null, TYPE, null); 41 | } 42 | public ItemEvent(final T ITEM, final EventType TYPE, final MouseEvent MOUSE_EVENT) { 43 | this(ITEM, null, TYPE, MOUSE_EVENT); 44 | } 45 | public ItemEvent(final T ITEM, final T TARGET_ITEM, final EventType TYPE) { 46 | this(ITEM, TARGET_ITEM, TYPE, null); 47 | } 48 | public ItemEvent(final T ITEM, final T TARGET_ITEM, final EventType TYPE, final MouseEvent MOUSE_EVENT) { 49 | this.ITEM = ITEM; 50 | this.TYPE = TYPE; 51 | this.TARGET_ITEM = TARGET_ITEM; 52 | this.MOUSE_EVENT = MOUSE_EVENT; 53 | } 54 | 55 | 56 | // ******************** Methods ******************************************* 57 | public T getItem() { return ITEM; } 58 | 59 | public T getTargetItem() { return TARGET_ITEM; } 60 | 61 | public EventType getEventType() { return TYPE; } 62 | 63 | public MouseEvent getMouseEvent() { return MOUSE_EVENT; } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/ItemEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | @FunctionalInterface 20 | public interface ItemEventListener { 21 | void onItemEvent(final ItemEvent EVENT); 22 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/LocationEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | import eu.hansolo.fx.charts.tools.Location; 20 | 21 | 22 | public class LocationEvent { 23 | private final Location LOCATION; 24 | private final EventType TYPE; 25 | 26 | 27 | // ******************** Constructors ************************************** 28 | public LocationEvent(final Location LOCATION) { 29 | this(LOCATION, EventType.UPDATE); 30 | } 31 | public LocationEvent(final Location LOCATION, final EventType TYPE) { 32 | this.LOCATION = LOCATION; 33 | this.TYPE = TYPE; 34 | } 35 | 36 | 37 | // ******************** Methods ******************************************* 38 | public Location getLocation() { return LOCATION; } 39 | 40 | public EventType getEventType() { return TYPE; } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/LocationEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | @FunctionalInterface 20 | public interface LocationEventListener { 21 | void onLocationEvent(final LocationEvent EVENT); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/MapConnectionEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | import eu.hansolo.fx.charts.data.MapConnection; 20 | 21 | 22 | public class MapConnectionEvent { 23 | private final EventType TYPE; 24 | private final T MAP_CONNECTION; 25 | 26 | 27 | // ******************** Constructors ************************************** 28 | public MapConnectionEvent(final EventType TYPE) { 29 | this(null, TYPE); 30 | } 31 | public MapConnectionEvent(final T MAP_CONNECTION) { 32 | this(MAP_CONNECTION, EventType.UPDATE); 33 | } 34 | public MapConnectionEvent(final T MAP_CONNECTION, final EventType TYPE) { 35 | this.MAP_CONNECTION = MAP_CONNECTION; 36 | this.TYPE = TYPE; 37 | } 38 | 39 | 40 | // ******************** Methods ******************************************* 41 | public T getMapConnection() { return MAP_CONNECTION; } 42 | 43 | public EventType getEventType() { return TYPE; } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/MapConnectionEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | @FunctionalInterface 20 | public interface MapConnectionEventListener { 21 | void onMapConnectionEvent(final MapConnectionEvent EVENT); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/PixelMatrixEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | import eu.hansolo.fx.charts.tools.Point; 20 | 21 | 22 | public class PixelMatrixEvent { 23 | private final int X; 24 | private final int Y; 25 | private final double MOUSE_SCREEN_X; 26 | private final double MOUSE_SCREEN_Y; 27 | private final EventType TYPE; 28 | 29 | 30 | // ******************** Constructors ************************************** 31 | public PixelMatrixEvent(final int X, final int Y, final double MOUSE_X, final double MOUSE_Y) { 32 | this(X, Y, MOUSE_X, MOUSE_Y, EventType.UPDATE); 33 | } 34 | public PixelMatrixEvent(final int X, final int Y, final double MOUSE_X, final double MOUSE_Y, final EventType TYPE) { 35 | this.X = X; 36 | this.Y = Y; 37 | this.MOUSE_SCREEN_X = MOUSE_X; 38 | this.MOUSE_SCREEN_Y = MOUSE_Y; 39 | this.TYPE = TYPE; 40 | } 41 | 42 | 43 | // ******************** Methods ******************************************* 44 | public int getX() { return X; } 45 | public int getY() { return Y; } 46 | 47 | public double getMouseScreenX() { return MOUSE_SCREEN_X; } 48 | public double getMouseScreenY() { return MOUSE_SCREEN_Y; } 49 | public Point getMouseScreenPos() { return new Point(MOUSE_SCREEN_X, MOUSE_SCREEN_Y); } 50 | 51 | public EventType getEventType() { return TYPE; } 52 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/PixelMatrixEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | 20 | @FunctionalInterface 21 | public interface PixelMatrixEventListener { 22 | void onPixelMatrixEvent(PixelMatrixEvent event); 23 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/SelectionEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | import eu.hansolo.fx.charts.data.ChartItem; 20 | import eu.hansolo.fx.charts.series.ChartItemSeries; 21 | 22 | 23 | public class SelectionEvent { 24 | private final ChartItemSeries SERIES; 25 | private final T ITEM; 26 | private final EventType TYPE; 27 | 28 | 29 | // ******************** Constructors ************************************** 30 | public SelectionEvent(final T ITEM) { 31 | this(null, ITEM, EventType.SELECTED); 32 | } 33 | public SelectionEvent(final ChartItemSeries SERIES) { 34 | this(SERIES, null, EventType.SELECTED); 35 | } 36 | public SelectionEvent(final ChartItemSeries SERIES, final T ITEM) { 37 | this(SERIES, ITEM, EventType.SELECTED); 38 | } 39 | public SelectionEvent(final ChartItemSeries SERIES, final T ITEM, final EventType TYPE) { 40 | this.SERIES = SERIES; 41 | this.ITEM = ITEM; 42 | this.TYPE = TYPE; 43 | } 44 | 45 | 46 | // ******************** Methods ******************************************* 47 | public ChartItemSeries getSeries() { return SERIES; } 48 | 49 | public T getItem() { return ITEM; } 50 | 51 | public EventType getEventType() { return TYPE; } 52 | 53 | @Override public String toString() { 54 | String ret; 55 | if (null == SERIES) { 56 | if (null == ITEM) { ret = "{}"; } 57 | // Only Item 58 | ret = new StringBuilder().append("{\n") 59 | .append(" \"item\" :\"").append(ITEM.getName()).append("\",\n") 60 | .append(" \"value\" :").append(ITEM.getValue()).append("\n") 61 | .append("}").toString(); 62 | } else { 63 | if (null == ITEM) { 64 | // Only Series 65 | ret = new StringBuilder().append("{\n") 66 | .append(" \"series\":\"").append(SERIES.getName()).append("\",\n") 67 | .append(" \"sum\" :").append(SERIES.getSumOfAllItems()).append("\n") 68 | .append("}").toString(); 69 | } else { 70 | // Series and Item 71 | ret = new StringBuilder().append("{\n") 72 | .append(" \"series\":\"").append(SERIES.getName()).append("\",\n") 73 | .append(" \"sum\" :").append(SERIES.getSumOfAllItems()).append(",\n") 74 | .append(" \"item\" :\"").append(ITEM.getName()).append("\",\n") 75 | .append(" \"value\" :").append(ITEM.getValue()).append("\n") 76 | .append("}").toString(); 77 | } 78 | } 79 | return ret; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/SelectionEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | @FunctionalInterface 20 | public interface SelectionEventListener { 21 | void onSelectionEvent(final SelectionEvent EVENT); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/SeriesEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | import eu.hansolo.fx.charts.data.ChartItem; 20 | import eu.hansolo.fx.charts.series.Series; 21 | 22 | 23 | /** 24 | * Created by hansolo on 16.07.17. 25 | */ 26 | public class SeriesEvent { 27 | private final Series SERIES; 28 | private final EventType TYPE; 29 | 30 | 31 | // ******************** Constructors ************************************** 32 | public SeriesEvent(final Series SERIES) { 33 | this(SERIES, EventType.UPDATE); 34 | } 35 | public SeriesEvent(final Series SERIES, final EventType TYPE) { 36 | this.SERIES = SERIES; 37 | this.TYPE = TYPE; 38 | } 39 | 40 | 41 | // ******************** Methods ******************************************* 42 | public Series getSeries() { return SERIES; } 43 | 44 | public EventType getEventType() { return TYPE; } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/SeriesEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | /** 20 | * Created by hansolo on 16.07.17. 21 | */ 22 | @FunctionalInterface 23 | public interface SeriesEventListener { 24 | void onModelEvent(final SeriesEvent EVENT); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/TreeNodeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | 20 | import eu.hansolo.fx.charts.data.Item; 21 | import eu.hansolo.fx.charts.data.TreeNode; 22 | 23 | 24 | public class TreeNodeEvent { 25 | private final TreeNode SRC; 26 | private final TreeNodeEventType TYPE; 27 | 28 | 29 | // ******************** Constructors ************************************** 30 | public TreeNodeEvent(final TreeNode SRC, final TreeNodeEventType TYPE) { 31 | this.SRC = SRC; 32 | this.TYPE = TYPE; 33 | } 34 | 35 | 36 | // ******************** Methods ******************************************* 37 | public TreeNode getSource() { return SRC; } 38 | 39 | public TreeNodeEventType getType() { return TYPE; } 40 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/TreeNodeEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.event; 18 | 19 | import eu.hansolo.fx.charts.data.Item; 20 | 21 | @FunctionalInterface 22 | public interface TreeNodeEventListener { 23 | void onTreeNodeEvent(final TreeNodeEvent EVENT); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/event/TreeNodeEventType.java: -------------------------------------------------------------------------------- 1 | package eu.hansolo.fx.charts.event; 2 | 3 | public enum TreeNodeEventType { 4 | 5 | PARENT_CHANGED, CHILDREN_CHANGED, NODE_SELECTED 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/forcedirectedgraph/GraphEdge.java: -------------------------------------------------------------------------------- 1 | package eu.hansolo.fx.charts.forcedirectedgraph; 2 | 3 | import javafx.beans.property.ObjectProperty; 4 | import javafx.beans.property.SimpleObjectProperty; 5 | 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | 11 | /** 12 | * authors: Michael L\u00E4uchli, MLaeuchli (github) 13 | * Stefan Mettler, orizion (github) 14 | */ 15 | public class GraphEdge { 16 | private ObjectProperty u; 17 | private ObjectProperty v; 18 | private double force; 19 | private double width; 20 | private HashMap nummericAttributes; 21 | 22 | 23 | 24 | public GraphEdge(GraphNode node1, GraphNode node2, double force, double width, Map nummericAttributes ){ 25 | this.u = new SimpleObjectProperty<>(node1); 26 | this.v = new SimpleObjectProperty<>(node2); 27 | this.force = force; 28 | this.width = width; 29 | this.nummericAttributes = new HashMap<>(nummericAttributes); 30 | addDefault(); 31 | } 32 | public GraphEdge(GraphNode node1, GraphNode node2,Map nummericAttributes ){ 33 | this(node1, node2, 1, 1, nummericAttributes); 34 | } 35 | public GraphEdge(GraphNode node1, GraphNode node2){ 36 | this(node1,node2, new HashMap<>()); 37 | } 38 | 39 | 40 | private void addDefault(){ 41 | nummericAttributes.put(NodeEdgeModel.DEFAULT, 1.0); 42 | } 43 | 44 | public double getForce() { 45 | return force; 46 | } 47 | public void setForce(double force) { 48 | this.force = force; 49 | } 50 | 51 | public double getWidth() { 52 | return width; 53 | } 54 | public void setWidth(double width) { 55 | this.width = width; 56 | } 57 | 58 | public GraphNode getU() { return u.get(); } 59 | public void setU(final GraphNode U) { u.set(U); } 60 | public ObjectProperty uProperty() { return u; } 61 | 62 | public GraphNode getV() { return v.get(); } 63 | public void setV(final GraphNode V) { v.set(V); } 64 | public ObjectProperty vProperty() { return v; } 65 | 66 | /** 67 | * Returns the chosen numeric attribute if it exists, else -1 is returned 68 | * @param key 69 | * @return 70 | */ 71 | public double getNummericAttribute(String key){ 72 | if(nummericAttributes.containsKey(key)) { 73 | return nummericAttributes.get(key); 74 | } 75 | return -1d; 76 | } 77 | 78 | public ArrayList getNummericAttributeKeys(){ 79 | ArrayList keys = new ArrayList<>(); 80 | for(Object o: nummericAttributes.keySet()){ 81 | if(o instanceof String){ 82 | keys.add((String) o); 83 | } 84 | } 85 | return keys; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/heatmap/HeatMapSpot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.heatmap; 18 | 19 | public class HeatMapSpot { 20 | private double x; 21 | private double y; 22 | private double radius; 23 | private OpacityDistribution opacityDistribution; 24 | 25 | 26 | // ******************** Constructors ************************************** 27 | public HeatMapSpot(final double X, final double Y) { 28 | this(X, Y, 15.5, OpacityDistribution.CUSTOM); 29 | } 30 | public HeatMapSpot(final double X, final double Y, final double RADIUS) { 31 | this(X, Y, RADIUS, OpacityDistribution.CUSTOM); 32 | } 33 | public HeatMapSpot(final double X, final double Y, final double RADIUS, final OpacityDistribution OPACITY_GRADIENT) { 34 | x = X; 35 | y = Y; 36 | radius = RADIUS; 37 | opacityDistribution = OPACITY_GRADIENT; 38 | } 39 | 40 | 41 | // ******************** Methods ******************************************* 42 | public double getX() { return x; } 43 | public double getY() { return y; } 44 | 45 | public double getRadius() { return radius; } 46 | public void setRadius(final double RADIUS) { radius = RADIUS; } 47 | 48 | public OpacityDistribution getOpacityDistribution() { return opacityDistribution; } 49 | public void setOpacityDistribution(final OpacityDistribution OPACITY_GRADIENT) { opacityDistribution = OPACITY_GRADIENT; } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/heatmap/OpacityDistribution.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.heatmap; 18 | 19 | public enum OpacityDistribution { 20 | EXPONENTIAL(0.90, 0.37, 0.14, 0.05, 0.02, 0.006, 0.002, 0.001, 0.0003, 0.0001, 0.0), 21 | TAN_HYP(0.90, 0.53, 0.24, 0.10, 0.04, 0.01, 0.005, 0.002, 0.0007, 0.0002, 0.0), 22 | CUSTOM(0.90, 0.56, 0.40, 0.28, 0.20, 0.14, 0.10, 0.07, 0.05, 0.03, 0.0), 23 | LINEAR(0.90, 0.81, 0.72, 0.63, 0.54, 0.45, 0.36, 0.27, 0.18, 0.09, 0.0); 24 | 25 | private double[] distribution; 26 | 27 | 28 | // ******************** Constructors ************************************** 29 | OpacityDistribution(final double... DISTRIBUTION) { 30 | distribution = DISTRIBUTION; 31 | } 32 | 33 | 34 | // ******************** Methods ******************************************* 35 | public double[] getDistribution() { return distribution; } 36 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/pareto/ParetoModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.pareto; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | 23 | /** 24 | * authors: Michael L\u00E4uchli, MLaeuchli (github) 25 | * Stefan Mettler, orizion (github) 26 | */ 27 | public class ParetoModel { 28 | 29 | private String title; 30 | private ArrayList data; 31 | 32 | 33 | // ******************** Constructors ************************************** 34 | /** 35 | * 36 | * @param title The Title displayed for the ParetoChart 37 | * @param data The data to be displayed 38 | */ 39 | public ParetoModel(String title, List data) { 40 | this.title = title; 41 | 42 | this.data = new ArrayList<>(data); 43 | } 44 | /** 45 | * 46 | * @param data The data to be displayed 47 | */ 48 | public ParetoModel(List data){ 49 | this("Pareto Chart", data); 50 | } 51 | /** 52 | * 53 | */ 54 | public ParetoModel() { 55 | this("Pareto Chart",new ArrayList<>()); 56 | } 57 | /** 58 | * 59 | * @param model Copy constructor 60 | */ 61 | public ParetoModel(ParetoModel model) { 62 | this.title = model.getTitle(); 63 | this.data = model.getData(); 64 | } 65 | 66 | 67 | // ******************** Methods ******************************************* 68 | /** 69 | * 70 | * @return The list of ParetoBars contained in this Model 71 | */ 72 | public ArrayList getData() { return data; } 73 | /** 74 | * 75 | * @param DATA Sets the passed List as the new List oif ParetoBars in the Model 76 | */ 77 | public void setData(final List DATA) { data = new ArrayList<>(DATA); } 78 | 79 | public String getTitle() { return title; } 80 | public void setTitle(final String TITLE) { this.title = TITLE; } 81 | 82 | /** 83 | * 84 | * @return Returns the smallest value among the ParetoBars 85 | */ 86 | public double getMin() { return this.getData().stream().mapToDouble(ParetoBar::getValue).min().orElse(0); } 87 | 88 | /** 89 | * @return Returns the biggest value among the ParetoBars 90 | */ 91 | public double getMax() { return this.getData().stream().mapToDouble(ParetoBar::getValue).max().orElse(0); } 92 | 93 | /** 94 | * 95 | * @return Returns the total value of all the ParetoBars 96 | */ 97 | public double getTotal() { return this.getData().stream().mapToDouble(ParetoBar::getValue).sum(); } 98 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/series/ChartItemSeries.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.series; 18 | 19 | import eu.hansolo.fx.charts.ChartType; 20 | import eu.hansolo.fx.charts.Symbol; 21 | import eu.hansolo.fx.charts.data.ChartItem; 22 | import javafx.collections.ObservableList; 23 | import javafx.scene.paint.Paint; 24 | 25 | import java.util.Arrays; 26 | import java.util.List; 27 | 28 | 29 | public class ChartItemSeries extends Series { 30 | 31 | // ******************** Constructors ************************************** 32 | public ChartItemSeries() { 33 | super(); 34 | } 35 | public ChartItemSeries(final ChartType TYPE, final String NAME, final T... ITEMS) { 36 | super(Arrays.asList(ITEMS), TYPE, NAME); 37 | } 38 | public ChartItemSeries(final ChartType TYPE, final String NAME, final Paint FILL, final Paint STROKE, final T... ITEMS) { 39 | super(Arrays.asList(ITEMS), TYPE, NAME, FILL, STROKE, Symbol.NONE); 40 | } 41 | public ChartItemSeries(final List ITEMS, final ChartType TYPE, final String NAME, final Paint FILL, final Paint STROKE) { 42 | super(ITEMS, TYPE, NAME, FILL, STROKE, Symbol.NONE); 43 | } 44 | public ChartItemSeries(final List ITEMS, final ChartType TYPE, final String NAME, final Paint FILL, final Paint STROKE, final Symbol SYMBOL) { 45 | super(ITEMS, TYPE, NAME, FILL, STROKE, SYMBOL); 46 | } 47 | 48 | 49 | // ******************** Methods ******************************************* 50 | @Override public ObservableList getItems() { return items; } 51 | 52 | public double getMinValue() { return items.stream().mapToDouble(T::getValue).min().orElse(0d); } 53 | public double getMaxValue() { return items.stream().mapToDouble(T::getValue).max().orElse(100d); } 54 | 55 | public double getSumOfAllItems() { return items.stream().mapToDouble(T::getValue).sum(); } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/series/MatrixItemSeries.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.series; 18 | 19 | import eu.hansolo.fx.charts.ChartType; 20 | import eu.hansolo.fx.charts.Symbol; 21 | import eu.hansolo.fx.charts.data.MatrixItem; 22 | import javafx.collections.ObservableList; 23 | 24 | import java.util.Comparator; 25 | import java.util.List; 26 | import java.util.Optional; 27 | 28 | 29 | public class MatrixItemSeries extends Series { 30 | 31 | // ******************** Constructors ************************************** 32 | public MatrixItemSeries() { 33 | this(null, ChartType.MATRIX_HEATMAP, ""); 34 | } 35 | public MatrixItemSeries(final List ITEMS, final ChartType TYPE) { 36 | this(ITEMS, TYPE, ""); 37 | } 38 | public MatrixItemSeries(final List ITEMS, final ChartType TYPE, final String NAME) { 39 | super(ITEMS, TYPE, NAME, Symbol.NONE); 40 | } 41 | 42 | 43 | // ******************** Methods ******************************************* 44 | @Override public ObservableList getItems() { return (ObservableList) items; } 45 | 46 | public int getMinX() { return getItems().stream().min(Comparator.comparingInt(T::getX)).get().getX(); } 47 | public int getMaxX() { return getItems().stream().max(Comparator.comparingInt(T::getX)).get().getX(); } 48 | 49 | public int getMinY() { return getItems().stream().min(Comparator.comparingInt(T::getY)).get().getY(); } 50 | public int getMaxY() { return getItems().stream().max(Comparator.comparingInt(T::getY)).get().getY(); } 51 | 52 | public double getMinZ() { return getItems().stream().min(Comparator.comparingDouble(T::getZ)).get().getZ(); } 53 | public double getMaxZ() { return getItems().stream().max(Comparator.comparingDouble(T::getZ)).get().getZ(); } 54 | 55 | public int getRangeX() { return getMaxX() - getMinX(); } 56 | public int getRangeY() { return getMaxY() - getMinY(); } 57 | public double getRangeZ() { return getMaxZ() - getMinZ(); } 58 | 59 | public double getAt(final int X, final int Y) { 60 | Optional selectedItem = getItems().stream().filter(item -> item.getX() == X).filter(item -> item.getY() == Y).findFirst(); 61 | return selectedItem.isPresent() ? selectedItem.get().getZ() : 0; 62 | } 63 | public void setAt(final int X, final int Y, final double Z) { 64 | Optional selectedItem = getItems().stream().filter(item -> item.getX() == X).filter(item -> item.getY() == Y).findFirst(); 65 | if (selectedItem.isPresent()) { selectedItem.get().setZ(Z); } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/series/XYZSeries.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.series; 18 | 19 | import eu.hansolo.fx.charts.ChartType; 20 | import eu.hansolo.fx.charts.Symbol; 21 | import eu.hansolo.fx.charts.data.XYZItem; 22 | import javafx.collections.ObservableList; 23 | 24 | import java.util.Comparator; 25 | import java.util.List; 26 | 27 | 28 | public class XYZSeries extends Series { 29 | 30 | // ******************** Constructors ************************************** 31 | public XYZSeries() { 32 | this(null, ChartType.BUBBLE, ""); 33 | } 34 | public XYZSeries(final List ITEMS, final ChartType TYPE) { 35 | this(ITEMS, TYPE, ""); 36 | } 37 | public XYZSeries(final List ITEMS, final ChartType TYPE, final String NAME) { 38 | super(ITEMS, TYPE, NAME); 39 | } 40 | public XYZSeries(final List ITEMS, final ChartType TYPE, final String NAME, final Symbol SYMBOL) { 41 | super(ITEMS, TYPE, NAME, SYMBOL); 42 | } 43 | 44 | 45 | // ******************** Methods ******************************************* 46 | @Override public ObservableList getItems() { return items; } 47 | 48 | public double getMinX() { return getItems().stream().min(Comparator.comparingDouble(T::getX)).get().getX(); } 49 | public double getMaxX() { return getItems().stream().max(Comparator.comparingDouble(T::getX)).get().getX(); } 50 | 51 | public double getMinY() { return getItems().stream().min(Comparator.comparingDouble(T::getY)).get().getY(); } 52 | public double getMaxY() { return getItems().stream().max(Comparator.comparingDouble(T::getY)).get().getY(); } 53 | 54 | public double getMinZ() { return getItems().stream().min(Comparator.comparingDouble(T::getZ)).get().getZ(); } 55 | public double getMaxZ() { return getItems().stream().max(Comparator.comparingDouble(T::getZ)).get().getZ(); } 56 | 57 | public double getRangeX() { return getMaxX() - getMinX(); } 58 | public double getRangeY() { return getMaxY() - getMinY(); } 59 | public double getRangeZ() { return getMaxZ() - getMinZ(); } 60 | 61 | public double getSumOfXValues() { return getItems().stream().mapToDouble(T::getX).sum(); } 62 | public double getSumOfYValues() { return getItems().stream().mapToDouble(T::getY).sum(); } 63 | public double getSumOfZValues() { return getItems().stream().mapToDouble(T::getZ).sum(); } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/series/YSeries.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.series; 18 | 19 | import eu.hansolo.fx.charts.ChartType; 20 | import eu.hansolo.fx.charts.Symbol; 21 | import eu.hansolo.fx.charts.data.ValueItem; 22 | import javafx.collections.ObservableList; 23 | import javafx.scene.paint.Color; 24 | import javafx.scene.paint.Paint; 25 | 26 | import java.util.Comparator; 27 | import java.util.List; 28 | 29 | 30 | public class YSeries extends Series { 31 | 32 | // ******************** Constructors ************************************** 33 | public YSeries() { 34 | this(null, ChartType.DONUT, "", Color.TRANSPARENT, Color.BLACK, Symbol.CIRCLE); 35 | } 36 | public YSeries(final List ITEMS, final ChartType TYPE) { 37 | this(ITEMS, TYPE, "", Color.TRANSPARENT, Color.BLACK, Symbol.CIRCLE); 38 | } 39 | public YSeries(final List ITEMS, final ChartType TYPE, final String NAME) { 40 | this(ITEMS, TYPE, NAME, Color.TRANSPARENT, Color.BLACK, Symbol.CIRCLE); 41 | } 42 | public YSeries(final List ITEMS, final ChartType TYPE, final Paint FILL, final Paint STROKE) { 43 | this(ITEMS, TYPE, "", FILL, STROKE, Symbol.CIRCLE); 44 | } 45 | public YSeries(final List ITEMS, final ChartType TYPE, final String NAME, final Paint FILL, final Paint STROKE) { 46 | super(ITEMS, TYPE, NAME, FILL, STROKE, Symbol.CIRCLE); 47 | } 48 | public YSeries(final List ITEMS, final ChartType TYPE, final String NAME, final Paint FILL, final Paint STROKE, final Symbol SYMBOL) { 49 | super(ITEMS, TYPE, NAME, FILL, STROKE, SYMBOL); 50 | } 51 | 52 | 53 | // ******************** Methods ******************************************* 54 | @Override public ObservableList getItems() { return items; } 55 | 56 | public double getMinY() { return getItems().stream().min(Comparator.comparingDouble(T::getValue)).get().getValue(); } 57 | public double getMaxY() { return getItems().stream().max(Comparator.comparingDouble(T::getValue)).get().getValue(); } 58 | 59 | public double getSumOfYValues() { return getItems().stream().mapToDouble(T::getValue).sum(); } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/CatmullRom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | public class CatmullRom { 20 | private CatmullRomSpline splineXValues; 21 | private CatmullRomSpline splineYValues; 22 | 23 | 24 | // ******************** Constructors ************************************** 25 | public CatmullRom(final T P0, final T P1, final T P2, final T P3) { 26 | assert P0 != null : "p0 cannot be null"; 27 | assert P1 != null : "p1 cannot be null"; 28 | assert P2 != null : "p2 cannot be null"; 29 | assert P3 != null : "p3 cannot be null"; 30 | 31 | splineXValues = new CatmullRomSpline(P0.getX(), P1.getX(), P2.getX(), P3.getX()); 32 | splineYValues = new CatmullRomSpline(P0.getY(), P1.getY(), P2.getY(), P3.getY()); 33 | } 34 | 35 | 36 | // ******************** Methods ******************************************* 37 | public T q(final double T) { return (T) new Point(splineXValues.q(T), splineYValues.q(T)); } 38 | 39 | 40 | // ******************** Inner Classes ************************************* 41 | class CatmullRomSpline { 42 | private double p0; 43 | private double p1; 44 | private double p2; 45 | private double p3; 46 | 47 | 48 | // ******************** Constructors ********************************** 49 | protected CatmullRomSpline(final double P0, final double P1, final double P2, final double P3) { 50 | p0 = P0; 51 | p1 = P1; 52 | p2 = P2; 53 | p3 = P3; 54 | } 55 | 56 | 57 | // ******************** Methods *************************************** 58 | protected double q(final double T) { 59 | return 0.5 * ((2 * p1) + (p2 - p0) * T + (2 * p0 - 5 * p1 + 4 * p2 - p3) * T * T + (3 * p1 -p0 - 3 * p2 + p3) * T * T * T); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/CtxCornerRadii.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | 20 | public class CtxCornerRadii { 21 | private double topLeft; 22 | private double topRight; 23 | private double bottomRight; 24 | private double bottomLeft; 25 | 26 | 27 | // ******************** Constructors ************************************** 28 | public CtxCornerRadii() { 29 | this(0, 0, 0, 0); 30 | } 31 | public CtxCornerRadii(final double RADIUS) { 32 | this(RADIUS, RADIUS, RADIUS, RADIUS); 33 | } 34 | public CtxCornerRadii(final double TOP_LEFT, final double TOP_RIGHT, 35 | final double BOTTOM_RIGHT, final double BOTTOM_LEFT) { 36 | topLeft = TOP_LEFT; 37 | topRight = TOP_RIGHT; 38 | bottomRight = BOTTOM_RIGHT; 39 | bottomLeft = BOTTOM_LEFT; 40 | } 41 | 42 | 43 | // ******************** Methods ******************************************* 44 | public double getTopLeft() { return topLeft; } 45 | public void setTopLeft(final double VALUE) { topLeft = Helper.clamp(0, Double.MAX_VALUE, VALUE); } 46 | 47 | public double getTopRight() { return topRight; } 48 | public void setTopRight(final double VALUE) { topRight = Helper.clamp(0, Double.MAX_VALUE, VALUE); } 49 | 50 | public double getBottomRight() { return bottomRight; } 51 | public void setBottomRight(final double VALUE) { bottomRight = Helper.clamp(0, Double.MAX_VALUE, VALUE); } 52 | 53 | public double getBottomLeft() { return bottomLeft; } 54 | public void setBottomLeft(final double VALUE) { bottomLeft = Helper.clamp(0, Double.MAX_VALUE, VALUE); } 55 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/FontMetrix.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts.tools; 20 | 21 | import javafx.geometry.Bounds; 22 | import javafx.scene.text.Font; 23 | import javafx.scene.text.Text; 24 | 25 | 26 | public class FontMetrix { 27 | private final Text internalText; 28 | private double ascent; 29 | private double descent; 30 | private double lineHeight; 31 | 32 | 33 | public FontMetrix(final Font font) { 34 | internalText = new Text(); 35 | internalText.setFont(font); 36 | final Bounds bounds = internalText.getLayoutBounds(); 37 | lineHeight = bounds.getHeight(); 38 | ascent = -bounds.getMinY(); 39 | descent = bounds.getMaxY(); 40 | } 41 | 42 | 43 | public double getAscent() { return ascent; } 44 | 45 | public double getDescent() { return descent; } 46 | 47 | public double getLineHeight() { return lineHeight; } 48 | 49 | public double computeStringWidth(final String text) { 50 | internalText.setText(text); 51 | return internalText.getLayoutBounds().getWidth(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/MapPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | import javafx.beans.property.DoubleProperty; 20 | import javafx.beans.property.ObjectProperty; 21 | import javafx.beans.property.ObjectPropertyBase; 22 | import javafx.beans.property.StringProperty; 23 | import javafx.beans.property.StringPropertyBase; 24 | import javafx.scene.paint.Color; 25 | 26 | 27 | public class MapPoint extends Point { 28 | private String _name; 29 | private StringProperty name; 30 | private Color _fill; 31 | private ObjectProperty fill; 32 | 33 | 34 | public MapPoint() { 35 | super(); 36 | this._name = ""; 37 | this._fill = Color.BLACK; 38 | } 39 | public MapPoint(final String NAME, final double LAT, final double LON) { 40 | this(NAME, Color.BLACK, LAT, LON); 41 | } 42 | public MapPoint(final String NAME, final Color FILL, final double LAT, final double LON) { 43 | super(LAT, LON); 44 | this._name = NAME; 45 | this._fill = FILL; 46 | } 47 | 48 | 49 | public String getName() { return null == name ? _name : name.get(); } 50 | public void setName(final String NAME) { 51 | if (null == this.name) { 52 | _name = NAME; 53 | } else { 54 | this.name.set(NAME); 55 | } 56 | } 57 | public StringProperty nameProperty() { 58 | if (null == name) { 59 | name = new StringPropertyBase(_name) { 60 | @Override protected void invalidated() {} 61 | @Override public Object getBean() { return MapPoint.this; } 62 | @Override public String getName() { return "name"; } 63 | }; 64 | _name = null; 65 | } 66 | return name; 67 | } 68 | 69 | public Color getFill() { return null == fill ? _fill : fill.get(); } 70 | public void setFill(final Color FILL) { 71 | if (null == fill) { 72 | _fill = FILL; 73 | } else { 74 | fill.set(FILL); 75 | } 76 | } 77 | public ObjectProperty fillProperty() { 78 | if (null == fill) { 79 | fill = new ObjectPropertyBase<>(_fill) { 80 | @Override protected void invalidated() {} 81 | @Override public Object getBean() { return MapPoint.this; } 82 | @Override public String getName() { return "fill"; } 83 | }; 84 | _fill = null; 85 | } 86 | return fill; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/NumberFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | public enum NumberFormat { 20 | NUMBER("%.0f"), 21 | FLOAT_1_DECIMAL("%.1f"), 22 | FLOAT_2_DECIMALS("%.2f"), 23 | FLOAT("%.8f"), 24 | PERCENTAGE("%.0f%%"), 25 | PERCENTAGE_1_DECIMAL("%.1f%%"); 26 | 27 | private final String FORMAT_STRING; 28 | 29 | NumberFormat(final String FORMAT_STRING) { 30 | this.FORMAT_STRING = FORMAT_STRING; 31 | } 32 | 33 | 34 | public String formatString() { return FORMAT_STRING; } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/Order.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | public enum Order { 20 | ASCENDING, DESCENDING 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | public class Pair { 20 | private T key; 21 | private U value; 22 | 23 | 24 | public Pair(final T key, final U value) { 25 | this.key = key; 26 | this.value = value; 27 | } 28 | 29 | 30 | public T getKey() { return key; } 31 | public void setKey(final T key) { this.key = key; } 32 | 33 | public U getValue() { return value; } 34 | public void setValue(final U value) { this.value = value; } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/Point.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | public class Point implements Comparable { 20 | private double x; 21 | private double y; 22 | private boolean empty; 23 | 24 | 25 | // ******************** Constructors ************************************** 26 | public Point() { 27 | this(0.0, 0.0, false); 28 | } 29 | public Point(final boolean IS_EMPTY) { 30 | this(0.0, 0.0, IS_EMPTY); 31 | } 32 | public Point(final double X, final double Y) { 33 | this(X, Y, false); 34 | } 35 | public Point(final double X, final double Y, final boolean IS_EMPTY) { 36 | x = X; 37 | y = Y; 38 | empty = IS_EMPTY; 39 | } 40 | 41 | 42 | // ******************** Methods ******************************************* 43 | public double getX() { return x; } 44 | public void setX(final double X) { x = X; } 45 | 46 | public double getY() { return y; } 47 | public void setY(final double Y) { y = Y; } 48 | 49 | public void set(final double X, final double Y) { 50 | x = X; 51 | y = Y; 52 | } 53 | 54 | public boolean isEmpty() { return empty; } 55 | public void setEmpty(final boolean isEmpty) { this.empty = isEmpty; } 56 | 57 | public double distanceTo(final Point P) { return distance(P.getX(), P.getY(), x, y); } 58 | public double distanceTo(final double X, final double Y) { return distance(X, Y, x, y); } 59 | 60 | public static double distance(final Point P1, final Point P2) { return distance(P1.getX(), P1.getY(), P2.getX(), P2.getY()); } 61 | public static double distance(final double X1, final double Y1, final double X2, final double Y2) { 62 | double deltaX = (X2 - X1); 63 | double deltaY = (Y2 - Y1); 64 | return Math.sqrt((deltaX * deltaX) + (deltaY * deltaY)); 65 | } 66 | 67 | public int compareTo(final Point POINT) { 68 | return x != POINT.getX() ? Double.compare(x, POINT.x) : Double.compare(y, POINT.y); 69 | } 70 | 71 | @Override public String toString() { 72 | return new StringBuilder().append("x: ").append(x).append(", y: ").append(y).toString(); 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/ScaleDirection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | public enum ScaleDirection { CLOCKWISE, COUNTER_CLOCKWISE, LEFT_TO_RIGHT, RIGHT_TO_LEFT, BOTTOM_TO_TOP, TOP_TO_BOTTOM } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/SortDirection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts.tools; 20 | 21 | public enum SortDirection { 22 | ASCENDING, DESCENDING 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/Statistics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts.tools; 20 | 21 | import eu.hansolo.fx.charts.data.XYItem; 22 | 23 | import java.util.Collections; 24 | import java.util.List; 25 | import java.util.stream.Collectors; 26 | 27 | 28 | public class Statistics { 29 | 30 | 31 | // ******************** Methods ******************************************* 32 | public static final double getXYItemMeanY(final List DATA) { 33 | return getMean(DATA.stream().map(XYItem::getY).collect(Collectors.toList())); 34 | } 35 | public static final double getMean(final List DATA) { return DATA.stream().mapToDouble(v -> v).sum() / DATA.size(); } 36 | 37 | public static final double getXYItemVarianceY(final List DATA) { 38 | return getVariance(DATA.stream().map(XYItem::getY).collect(Collectors.toList())); 39 | } 40 | public static final double getVariance(final List DATA) { 41 | double mean = getMean(DATA); 42 | double temp = 0; 43 | for (double a : DATA) { temp += ((a - mean) * (a - mean)); } 44 | return temp / DATA.size(); 45 | } 46 | 47 | public static final double getXYItemStdDevY(final List DATA) { 48 | return getStdDev(DATA.stream().map(XYItem::getY).collect(Collectors.toList())); 49 | } 50 | public static final double getStdDev(final List DATA) { return Math.sqrt(getVariance(DATA)); } 51 | 52 | public static final double getXYItemMedianY(final List DATA) { 53 | return getMedian(DATA.stream().map(XYItem::getY).collect(Collectors.toList())); 54 | } 55 | public static final double getMedian(final List DATA) { 56 | int size = DATA.size(); 57 | Collections.sort(DATA); 58 | return size % 2 == 0 ? (DATA.get((size / 2) - 1) + DATA.get(size / 2)) / 2.0 : DATA.get(size / 2); 59 | } 60 | 61 | public static final double getXYItemMinY(final List DATA) { 62 | return getMin(DATA.stream().map(XYItem::getY).collect(Collectors.toList())); 63 | } 64 | public static final double getMin(final List DATA) { return DATA.stream().mapToDouble(v -> v).min().orElse(0); } 65 | 66 | public static final double getXYItemMaxY(final List DATA) { 67 | return getMax(DATA.stream().map(XYItem::getY).collect(Collectors.toList())); 68 | } 69 | public static final double getMax(final List DATA) { return DATA.stream().mapToDouble(v -> v).max().orElse(0); } 70 | 71 | public static final double getXYItemAverageY(final List DATA) { 72 | return getAverage(DATA.stream().map(XYItem::getY).collect(Collectors.toList())); 73 | } 74 | public static final double getAverage(final List DATA) { 75 | return DATA.stream().mapToDouble(data -> data.doubleValue()).average().orElse(-1); 76 | } 77 | 78 | public static final double percentile(List entries, double percentile) { 79 | Collections.sort(entries); 80 | int index = (int) Math.ceil(percentile / 100.0 * entries.size()); 81 | return entries.get(index-1); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/TickLabelFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | public enum TickLabelFormat { 20 | NUMBER, TIME 21 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/TickLabelLocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | public enum TickLabelLocation { 20 | INSIDE, OUTSIDE 21 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/TickLabelOrientation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.tools; 18 | 19 | public enum TickLabelOrientation { 20 | ORTHOGONAL, HORIZONTAL, TANGENT 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/tools/Topic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts.tools; 20 | 21 | public enum Topic { 22 | INDEX, VALUE, NAME 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/voronoi/ArraySet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts.voronoi; 20 | 21 | import java.util.AbstractSet; 22 | import java.util.ArrayList; 23 | import java.util.Collection; 24 | import java.util.Iterator; 25 | 26 | 27 | public class ArraySet extends AbstractSet { 28 | 29 | private ArrayList items; 30 | 31 | public ArraySet() { 32 | this(new ArrayList<>(3)); 33 | } 34 | public ArraySet(final int initialCapacity) { 35 | this(new ArrayList<>(initialCapacity)); 36 | } 37 | public ArraySet(Collection collection) { 38 | items = new ArrayList(collection.size()); 39 | for (E item : collection) { 40 | if (!items.contains(item)) { items.add(item); } 41 | } 42 | } 43 | 44 | 45 | public E get(final int index) throws IndexOutOfBoundsException { return items.get(index); } 46 | 47 | public boolean containsAny(final Collection collection) { 48 | return collection.stream().filter(item -> this.contains(item)).findFirst().isPresent(); 49 | } 50 | 51 | @Override public boolean add(E item) { 52 | if (items.contains(item)) { return false; } 53 | return items.add(item); 54 | } 55 | 56 | @Override public Iterator iterator() { 57 | return items.iterator(); 58 | } 59 | 60 | @Override public int size() { 61 | return items.size(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/voronoi/Graph.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts.voronoi; 20 | 21 | import java.util.Collections; 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | import java.util.Set; 25 | 26 | 27 | public class Graph { 28 | private Map> neighbours = new HashMap<>(); 29 | private Set nodes = Collections.unmodifiableSet(neighbours.keySet()); 30 | 31 | 32 | public Set getNeighbours(final N node) throws NullPointerException { 33 | return Collections.unmodifiableSet(neighbours.get(node)); 34 | } 35 | 36 | public Set getNodes() { 37 | return nodes; 38 | } 39 | 40 | public void addNode(final N node) { 41 | if (neighbours.containsKey(node)) { return; } 42 | neighbours.put(node, new ArraySet()); 43 | } 44 | public void removeNode(final N node) { 45 | if (!neighbours.containsKey(node)) { return; } 46 | for (N neighbor : neighbours.get(node)) { 47 | neighbours.get(neighbor).remove(node); 48 | } 49 | neighbours.get(node).clear(); 50 | neighbours.remove(node); 51 | } 52 | 53 | public void addConnection(final N nodeA, final N nodeB) throws NullPointerException { 54 | neighbours.get(nodeA).add(nodeB); 55 | neighbours.get(nodeB).add(nodeA); 56 | } 57 | public void removeConnection(final N nodeA, final N nodeB) throws NullPointerException { 58 | neighbours.get(nodeA).remove(nodeB); 59 | neighbours.get(nodeB).remove(nodeA); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/voronoi/Triangle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts.voronoi; 20 | 21 | import java.util.Arrays; 22 | import java.util.Collection; 23 | import java.util.Iterator; 24 | import java.util.NoSuchElementException; 25 | 26 | 27 | class Triangle extends ArraySet { 28 | private int idNumber; // The id number 29 | private VPoint circumcenter = null; // The triangle's circumcenter 30 | 31 | private static int idGenerator = 0; // Used to create id numbers 32 | public static boolean moreInfo = false; // True iff more info in toString 33 | 34 | 35 | public Triangle(final VPoint... vertices) { 36 | this(Arrays.asList(vertices)); 37 | } 38 | public Triangle(Collection collection) { 39 | super(collection); 40 | idNumber = idGenerator++; 41 | if (this.size() != 3) { throw new IllegalArgumentException("Triangle must have 3 vertices"); } 42 | } 43 | 44 | 45 | public VPoint getVertexButNot(final VPoint... badVertices) { 46 | Collection bad = Arrays.asList(badVertices); 47 | for (VPoint v : this) { if (!bad.contains(v)) { return v; } } 48 | throw new NoSuchElementException("No vertex found"); 49 | } 50 | 51 | public boolean isNeighbor(final Triangle triangle) { 52 | int count = 0; 53 | for (VPoint vertex : this) { if (!triangle.contains(vertex)) { count++; } } 54 | return count == 1; 55 | } 56 | 57 | public ArraySet facetOpposite(final VPoint vertex) { 58 | ArraySet facet = new ArraySet(this); 59 | if (!facet.remove(vertex)) { throw new IllegalArgumentException("Vertex not in triangle"); } 60 | return facet; 61 | } 62 | 63 | public VPoint getCircumCenter() { 64 | if (circumcenter == null) { circumcenter = VPoint.circumcenter(this.toArray(new VPoint[0])); } 65 | return circumcenter; 66 | } 67 | 68 | 69 | @Override public boolean add(VPoint vertex) { 70 | throw new UnsupportedOperationException(); 71 | } 72 | 73 | @Override public Iterator iterator() { 74 | return new Iterator() { 75 | private Iterator it = Triangle.super.iterator(); 76 | public boolean hasNext() { return it.hasNext(); } 77 | public VPoint next() { return it.next(); } 78 | public void remove() { throw new UnsupportedOperationException(); } 79 | }; 80 | } 81 | 82 | 83 | @Override public int hashCode() { 84 | return (int) (idNumber ^ (idNumber >>> 32)); 85 | } 86 | 87 | @Override public boolean equals(Object o) { 88 | return (this == o); 89 | } 90 | 91 | @Override public String toString() { 92 | if (!moreInfo) { return "Triangle" + idNumber; } 93 | return "Triangle" + idNumber + super.toString(); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/world/BusinessRegion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.world; 18 | 19 | import javafx.scene.paint.Color; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import static eu.hansolo.fx.charts.world.Country.*; 25 | 26 | 27 | /** 28 | * Created by hansolo on 01.12.16. 29 | */ 30 | public enum BusinessRegion implements CRegion { 31 | AMERICAS(AI, AG, AR, AW, BS, BB, BZ, BM, BO, BR, CA, KY, CL, CO, CR, CU, DM, DO, EC, SV, GF, GD, GP, GT, GY, HT, HN, JM, MQ, MX, MS, NI, PA, PY, PE, PR, BL, KN, LC, MF, PM, VC, SR, TT, TC, US, UY, VE, VG, VI), 32 | APAC(AS, AU, BD, BN, BT, CC, CK, CN, CX, FJ, FM, GU, HK, ID, IN, IO, JP, KH, KI, KP, KR, LA, LK, MH, MM, MN, MO, MP, MV, MY, NC, NF, NP, NR, NU, NZ, PF, PG, PH, PK, PN, PW, SB, SG, TH, TK, TL, TO, TV, TW, VN, VU, WF, WS), 33 | APJC(AS, AU, BD, BN, BT, CC, CK, CN, CX, FJ, FM, GU, HK, HM, ID, IN, IO, JP, KH, KI, KP, KR, LA, LK, MH, MM, MN, MO, MP, MV, MY, NC, NF, NP, NR, NU, NZ, PF, PG, PH, PN, PW, SB, SG, TH, TK, TL, TO, TV, TW, VN, VU, WS), 34 | ANZ(AU, NZ), 35 | BENELUX(BE, NL, LU), 36 | BRICS(RU, BR, CN, IN, ZA), 37 | DACH(DE, AT, CH), 38 | EMEA(AF, AX, AL, DZ, AD, AO, AM, AT, AZ, BH, BY, BE, BJ, BA, BW, BV, BG, BF, BI, CM, CV, CF, TD, KM, CD, CG, HR, CY, CZ, DK, DJ, EG, GQ, ER, EE, ET, FK, FO, FI, FR, GA, GM, GE, DE, GH, GI, GR, GL, GG, GW, HU, IS, IR, IQ, IE, IM, IL, IT, CI, JE, JO, KZ, KE, XK, KW, KG, LV, LB, LS, LR, LY, LI, LT, LU, MK, MG, MW, ML, MT, MR, MU, YT, MD, MC, ME, MA, MZ, NA, NL, NE, NG, NO, OM, PK, PS, PL, PT, QA, RE, RO, RU, RW, SH, SM, ST, SA, SN, RS, SC, SL, SK, SI, SO, ZA, GS, ES, SD, SJ, SZ, SE, CH, SY, TJ, TZ, TG, TN, TR, TM, UG, UA, AE, GB, UZ, VA, EH, YE, ZM, ZW), 39 | EU(BE, GR, LT, PT, BG, ES, LU, RO, CZ, FR, HU, SI, DK, HR, MT, SK, DE, IT, NL, FI, EE, CY, AT, SE, IE, LV, PL, GB), 40 | NORAM(US, CA, MX, GT, BZ, CU, DO, HT, HN, SV, NI, CR, PA); 41 | 42 | private List countries; 43 | 44 | 45 | // ******************** Constructors ************************************** 46 | BusinessRegion(final Country... COUNTRIES) { 47 | countries = new ArrayList<>(COUNTRIES.length); 48 | for(Country country : COUNTRIES) { countries.add(country); } 49 | } 50 | 51 | 52 | // ******************** Methods ******************************************* 53 | @Override public List getCountries() { return countries; } 54 | 55 | @Override public void setColor(final Color COLOR) { 56 | for (Country country : getCountries()) { country.setColor(COLOR); } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/world/CRegion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.world; 18 | 19 | import javafx.scene.paint.Color; 20 | 21 | import java.util.List; 22 | 23 | 24 | /** 25 | * Created by hansolo on 01.12.16. 26 | */ 27 | public interface CRegion { 28 | 29 | String name(); 30 | 31 | List getCountries(); 32 | 33 | void setColor(final Color COLOR); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/world/CountryPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.world; 18 | 19 | import javafx.scene.control.Tooltip; 20 | import javafx.scene.shape.SVGPath; 21 | 22 | import java.util.Locale; 23 | 24 | 25 | /** 26 | * Created by hansolo on 20.09.16. 27 | */ 28 | public class CountryPath extends SVGPath { 29 | private String name; 30 | private Locale locale; 31 | private Tooltip tooltip; 32 | 33 | 34 | // ******************** Constructors ************************************** 35 | public CountryPath() { 36 | this ("", null); 37 | } 38 | public CountryPath(final String NAME) { 39 | this(NAME, null); 40 | } 41 | public CountryPath(final String NAME, final String CONTENT) { 42 | super(); 43 | name = NAME; 44 | locale = new Locale("", NAME); 45 | tooltip = new Tooltip(locale.getDisplayCountry()); 46 | Tooltip.install(CountryPath.this, tooltip); 47 | if (null == CONTENT) return; 48 | setContent(CONTENT); 49 | } 50 | 51 | 52 | // ******************** Methods ******************************************* 53 | public String getName() { return name; } 54 | public void setName(final String NAME) { this.name = NAME; } 55 | 56 | public Locale getLocale() { return locale; } 57 | public void setLocale(final Locale LOCALE) { locale = LOCALE; } 58 | 59 | public Tooltip getTooltip() { return tooltip; } 60 | public void setTooltip(final Tooltip TOOLTIP) { 61 | tooltip = TOOLTIP; 62 | Tooltip.install(CountryPath.this, tooltip); 63 | } 64 | 65 | @Override public String toString() { 66 | return new StringBuilder("{\n").append(" name :\"").append(name).append("\"\n") 67 | .append(" locale :\"").append(locale).append("\"\n") 68 | .append(" tooltip:\"").append(tooltip.getText()).append("\"\n") 69 | .append(" content:\"").append(getContent()).append("\"\n") 70 | .append("}\n") 71 | .toString(); 72 | } 73 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/world/CountryRegion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.world; 18 | 19 | import javafx.scene.paint.Color; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | 25 | /** 26 | * Created by hansolo on 01.12.16. 27 | */ 28 | public class CountryRegion implements CRegion { 29 | private String name; 30 | private List countries; 31 | 32 | 33 | // ******************** Constructors ************************************** 34 | public CountryRegion(final String NAME, final Country... COUNTRIES) { 35 | name = NAME; 36 | countries = new ArrayList<>(COUNTRIES.length); 37 | for (Country country : COUNTRIES) { countries.add(country); } 38 | } 39 | 40 | 41 | // ******************** Methods ******************************************* 42 | @Override public String name() { return name; } 43 | 44 | @Override public List getCountries() { return countries; } 45 | 46 | @Override public void setColor(final Color COLOR) { 47 | for (Country country : getCountries()) { country.setColor(COLOR); } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/charts/world/ValueObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts.world; 18 | 19 | /** 20 | * @author Andres Almiray 21 | */ 22 | public interface ValueObject { 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/BaseBounds.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry; 18 | 19 | import eu.hansolo.fx.geometry.tools.Point; 20 | 21 | 22 | public abstract class BaseBounds { 23 | 24 | public abstract BaseBounds copy(); 25 | 26 | public abstract double getWidth(); 27 | public abstract double getHeight(); 28 | 29 | public abstract double getMinX(); 30 | public abstract double getMinY(); 31 | 32 | public abstract double getMaxX(); 33 | public abstract double getMaxY(); 34 | 35 | public abstract void translate(double x, double y, double z); 36 | 37 | public abstract Point getMin(Point min); 38 | public abstract Point getMax(Point max); 39 | 40 | public abstract BaseBounds deriveWithUnion(BaseBounds other); 41 | 42 | public abstract BaseBounds deriveWithNewBounds(Rectangle other); 43 | public abstract BaseBounds deriveWithNewBounds(BaseBounds other); 44 | public abstract BaseBounds deriveWithNewBounds(double minX, double minY, double maxX, double maxY); 45 | 46 | public abstract BaseBounds deriveWithNewBoundsAndSort(double minX, double minY, double maxX, double maxY); 47 | 48 | public abstract BaseBounds deriveWithPadding(double horizontal, double vertical); 49 | 50 | public abstract void intersectWith(Rectangle other); 51 | public abstract void intersectWith(BaseBounds other); 52 | 53 | public abstract void intersectWith(double minX, double minY, double maxX, double maxY); 54 | 55 | public abstract void setBoundsAndSort(Point p1, Point p2); 56 | public abstract void setBoundsAndSort(double minX, double minY, double maxX, double maxY); 57 | 58 | public abstract void add(Point p); 59 | public abstract void add(double x, double y); 60 | 61 | public abstract boolean contains(Point p); 62 | 63 | public abstract boolean contains(double x, double y); 64 | 65 | public abstract boolean intersects(double x, double y, double width, double height); 66 | 67 | public abstract boolean isEmpty(); 68 | 69 | public abstract void roundOut(); 70 | 71 | public abstract BaseBounds makeEmpty(); 72 | 73 | public abstract boolean disjoint(double x, double y, double width, double height); 74 | 75 | protected abstract void sortMinMax(); 76 | 77 | public static BaseBounds getInstance(double minX, double minY, double maxX, double maxY) { 78 | return new RectBounds(minX, minY, maxX, maxY); 79 | } 80 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/BezierCurveIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry; 18 | 19 | import eu.hansolo.fx.geometry.Path.WindingRule; 20 | import eu.hansolo.fx.geometry.transform.BaseTransform; 21 | 22 | import java.util.NoSuchElementException; 23 | 24 | 25 | class BezierCurveIterator implements PathIterator { 26 | BezierCurve bezierCurve; 27 | BaseTransform transform; 28 | int index; 29 | 30 | 31 | BezierCurveIterator(BezierCurve bezierCurve, BaseTransform transform) { 32 | this.bezierCurve = bezierCurve; 33 | this.transform = transform; 34 | } 35 | 36 | 37 | public boolean isDone() { 38 | return (index > 1); 39 | } 40 | 41 | public void next() { 42 | ++index; 43 | } 44 | 45 | public WindingRule getWindingRule() { return WindingRule.WIND_NON_ZERO; } 46 | 47 | public int currentSegment(final double[] COORDS) { 48 | if (isDone()) { throw new NoSuchElementException("bezierCurve iterator iterator out of bounds"); } 49 | int type; 50 | if (index == 0) { 51 | COORDS[0] = bezierCurve.x1; 52 | COORDS[1] = bezierCurve.y1; 53 | type = MOVE_TO; 54 | } else { 55 | COORDS[0] = bezierCurve.ctrlx1; 56 | COORDS[1] = bezierCurve.ctrly1; 57 | COORDS[2] = bezierCurve.ctrlx2; 58 | COORDS[3] = bezierCurve.ctrly2; 59 | COORDS[4] = bezierCurve.x2; 60 | COORDS[5] = bezierCurve.y2; 61 | type = BEZIER_TO; 62 | } 63 | if (transform != null) { transform.transform(COORDS, 0, COORDS, 0, index == 0 ? 1 : 3); } 64 | return type; 65 | } 66 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/Circle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry; 18 | 19 | public class Circle extends Ellipse { 20 | 21 | public Circle(final double CENTER_X, final double CENTER_Y, final double RADIUS) { 22 | super(CENTER_X - RADIUS, CENTER_Y - RADIUS, RADIUS * 2, RADIUS * 2); 23 | } 24 | 25 | public double getRadius() { return getRadiusX(); } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/EllipseIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry; 18 | 19 | import eu.hansolo.fx.geometry.Path.WindingRule; 20 | import eu.hansolo.fx.geometry.transform.BaseTransform; 21 | 22 | import java.util.NoSuchElementException; 23 | 24 | 25 | class EllipseIterator implements PathIterator { 26 | double x, y, w, h; 27 | BaseTransform transform; 28 | int index; 29 | 30 | // ArcIterator.btan(Math.PI/2) 31 | public static final double CtrlVal = 0.5522847498307933; 32 | 33 | private static final double pcv = 0.5 + CtrlVal * 0.5; 34 | private static final double ncv = 0.5 - CtrlVal * 0.5; 35 | private static final double ctrlpts[][] = { 36 | { 1.0, pcv, pcv, 1.0, 0.5, 1.0 }, 37 | { ncv, 1.0, 0.0, pcv, 0.0, 0.5 }, 38 | { 0.0, ncv, ncv, 0.0, 0.5, 0.0 }, 39 | { pcv, 0.0, 1.0, ncv, 1.0, 0.5 } 40 | }; 41 | 42 | 43 | EllipseIterator(final Ellipse ELLIPSE, final BaseTransform TRANSFORM) { 44 | x = ELLIPSE.x; 45 | y = ELLIPSE.y; 46 | w = ELLIPSE.width; 47 | h = ELLIPSE.height; 48 | transform = TRANSFORM; 49 | if (w < 0.0 || h < 0.0) { index = 6; } 50 | } 51 | 52 | 53 | public boolean isDone() { return index > 5; } 54 | 55 | public void next() { ++index; } 56 | 57 | public WindingRule getWindingRule() { return WindingRule.WIND_NON_ZERO; } 58 | 59 | public int currentSegment(final double[] COORDS) { 60 | if (isDone()) { throw new NoSuchElementException("ellipse iterator out of bounds"); } 61 | if (index == 5) { return CLOSE; } 62 | if (index == 0) { 63 | double ctrls[] = ctrlpts[3]; 64 | COORDS[0] = (x + ctrls[4] * w); 65 | COORDS[1] = (y + ctrls[5] * h); 66 | if (transform != null) { transform.transform(COORDS, 0, COORDS, 0, 1); } 67 | return MOVE_TO; 68 | } 69 | double ctrls[] = ctrlpts[index - 1]; 70 | COORDS[0] = (x + ctrls[0] * w); 71 | COORDS[1] = (y + ctrls[1] * h); 72 | COORDS[2] = (x + ctrls[2] * w); 73 | COORDS[3] = (y + ctrls[3] * h); 74 | COORDS[4] = (x + ctrls[4] * w); 75 | COORDS[5] = (y + ctrls[5] * h); 76 | if (transform != null) { transform.transform(COORDS, 0, COORDS, 0, 3); } 77 | return BEZIER_TO; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/LineIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry; 18 | 19 | import eu.hansolo.fx.geometry.Path.WindingRule; 20 | import eu.hansolo.fx.geometry.transform.BaseTransform; 21 | 22 | import java.util.NoSuchElementException; 23 | 24 | 25 | class LineIterator implements PathIterator { 26 | Line line; 27 | BaseTransform transform; 28 | int index; 29 | 30 | 31 | LineIterator(final Line LINE, final BaseTransform TRANSFORM) { 32 | line = LINE; 33 | transform = TRANSFORM; 34 | } 35 | 36 | 37 | public boolean isDone() { return (index > 1); } 38 | 39 | public void next() { ++index; } 40 | 41 | public WindingRule getWindingRule() { return WindingRule.WIND_NON_ZERO; } 42 | 43 | public int currentSegment(final double[] COORDS) { 44 | if (isDone()) { throw new NoSuchElementException("line iterator out of bounds"); } 45 | int type; 46 | if (index == 0) { 47 | COORDS[0] = line.x1; 48 | COORDS[1] = line.y1; 49 | type = MOVE_TO; 50 | } else { 51 | COORDS[0] = line.x2; 52 | COORDS[1] = line.y2; 53 | type = LINE_TO; 54 | } 55 | if (transform != null) { transform.transform(COORDS, 0, COORDS, 0, 1); } 56 | return type; 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/PathIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry; 18 | 19 | import eu.hansolo.fx.geometry.Path.WindingRule; 20 | 21 | 22 | public interface PathIterator { 23 | int MOVE_TO = 0; 24 | int LINE_TO = 1; 25 | int QUAD_TO = 2; 26 | int BEZIER_TO = 3; 27 | int CLOSE = 4; 28 | 29 | WindingRule getWindingRule(); 30 | 31 | boolean isDone(); 32 | 33 | void next(); 34 | 35 | int currentSegment(double[] coords); 36 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/QuadIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry; 18 | 19 | import eu.hansolo.fx.geometry.Path.WindingRule; 20 | import eu.hansolo.fx.geometry.transform.BaseTransform; 21 | 22 | import java.util.NoSuchElementException; 23 | 24 | 25 | class QuadIterator implements PathIterator { 26 | QuadCurve quadCurve; 27 | BaseTransform transform; 28 | int index; 29 | 30 | 31 | QuadIterator(final QuadCurve QUAD_CURVE, final BaseTransform TRANSFORM) { 32 | quadCurve = QUAD_CURVE; 33 | transform = TRANSFORM; 34 | } 35 | 36 | 37 | public WindingRule getWindingRule() { return WindingRule.WIND_NON_ZERO; } 38 | 39 | public boolean isDone() { return (index > 1); } 40 | 41 | public void next() { ++index; } 42 | 43 | public int currentSegment(double[] coords) { 44 | if (isDone()) { throw new NoSuchElementException("quadCurve iterator iterator out of bounds"); } 45 | int type; 46 | if (index == 0) { 47 | coords[0] = quadCurve.x1; 48 | coords[1] = quadCurve.y1; 49 | type = MOVE_TO; 50 | } else { 51 | coords[0] = quadCurve.ctrlx; 52 | coords[1] = quadCurve.ctrly; 53 | coords[2] = quadCurve.x2; 54 | coords[3] = quadCurve.y2; 55 | type = QUAD_TO; 56 | } 57 | if (transform != null) { transform.transform(coords, 0, coords, 0, index == 0 ? 1 : 2); } 58 | return type; 59 | } 60 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/RectangularShape.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry; 18 | 19 | import eu.hansolo.fx.geometry.transform.BaseTransform; 20 | import eu.hansolo.fx.geometry.tools.Point; 21 | 22 | 23 | public abstract class RectangularShape extends Shape { 24 | 25 | protected RectangularShape() { } 26 | 27 | public abstract double getX(); 28 | public abstract double getY(); 29 | 30 | public abstract double getWidth(); 31 | public abstract double getHeight(); 32 | 33 | public double getMinX() { 34 | return getX(); 35 | } 36 | public double getMinY() { 37 | return getY(); 38 | } 39 | 40 | public double getMaxX() { 41 | return getX() + getWidth(); 42 | } 43 | public double getMaxY() { 44 | return getY() + getHeight(); 45 | } 46 | 47 | public double getCenterX() { 48 | return getX() + getWidth() / 2; 49 | } 50 | public double getCenterY() { 51 | return getY() + getHeight() / 2; 52 | } 53 | 54 | public abstract boolean isEmpty(); 55 | 56 | public abstract void set(double x, double y, double w, double h); 57 | 58 | public void set(final Point POINT, final double WIDTH, final double HEIGHT) { 59 | set(POINT.getX(), POINT.getY(), WIDTH, HEIGHT); 60 | } 61 | 62 | public void setFromDiagonal(Point p1, Point p2) { 63 | setFromDiagonal(p1.x, p1.y, p2.x, p2.y); 64 | } 65 | public void setFromDiagonal(double x1, double y1, double x2, double y2) { 66 | if (x2 < x1) { 67 | double t = x1; 68 | x1 = x2; 69 | x2 = t; 70 | } 71 | if (y2 < y1) { 72 | double t = y1; 73 | y1 = y2; 74 | y2 = t; 75 | } 76 | set(x1, y1, x2 - x1, y2 - y1); 77 | } 78 | 79 | public void setFromCenter(final Point CENTER, final Point CORNER) { 80 | setFromCenter(CENTER.x, CENTER.y, CORNER.x, CORNER.y); 81 | } 82 | public void setFromCenter(final double CENTER_X, final double CENTER_Y, final double CORNER_X, final double CORNER_Y) { 83 | double halfW = Math.abs(CORNER_X - CENTER_X); 84 | double halfH = Math.abs(CORNER_Y - CENTER_Y); 85 | set(CENTER_X - halfW, CENTER_Y - halfH, halfW * 2.0, halfH * 2.0); 86 | } 87 | 88 | public boolean contains(Point POINT) { return contains(POINT.x, POINT.y); } 89 | 90 | public RectBounds getBounds() { 91 | double width = getWidth(); 92 | double height = getHeight(); 93 | if (width < 0 || height < 0) { return new RectBounds(); } 94 | double x = getX(); 95 | double y = getY(); 96 | double x1 = Math.floor(x); 97 | double y1 = Math.floor(y); 98 | double x2 = Math.ceil(x + width); 99 | double y2 = Math.ceil(y + height); 100 | return new RectBounds(x1, y1, x2, y2); 101 | } 102 | 103 | public PathIterator getPathIterator(BaseTransform TRANSFORM, double FLATNESS) { 104 | return new FlatteningPathIterator(getPathIterator(TRANSFORM), FLATNESS); 105 | } 106 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/tools/Helper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry.tools; 18 | 19 | 20 | public class Helper { 21 | 22 | public static final int clamp(final int MIN, final int MAX, final int VALUE) { 23 | if (VALUE < MIN) return MIN; 24 | if (VALUE > MAX) return MAX; 25 | return VALUE; 26 | } 27 | public static final long clamp(final long MIN, final long MAX, final long VALUE) { 28 | if (VALUE < MIN) return MIN; 29 | if (VALUE > MAX) return MAX; 30 | return VALUE; 31 | } 32 | public static final double clamp(final double MIN, final double MAX, final double VALUE) { 33 | if (Double.compare(VALUE, MIN) < 0) return MIN; 34 | if (Double.compare(VALUE, MAX) > 0) return MAX; 35 | return VALUE; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/tools/IllegalPathStateException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry.tools; 18 | 19 | public class IllegalPathStateException extends RuntimeException { 20 | 21 | public IllegalPathStateException() { 22 | } 23 | public IllegalPathStateException(String s) { 24 | super (s); 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/tools/NonInvertibleTransformException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry.tools; 18 | 19 | public class NonInvertibleTransformException extends java.lang.Exception { 20 | 21 | public NonInvertibleTransformException(String s) { 22 | super (s); 23 | } 24 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/tools/Point.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry.tools; 18 | 19 | public class Point implements Comparable { 20 | public double x; 21 | public double y; 22 | 23 | 24 | // ******************** Constructors ************************************** 25 | public Point() { 26 | this(0.0, 0.0); 27 | } 28 | public Point(final Point P) { 29 | this(P.getX(), P.getY()); 30 | } 31 | public Point(final double X, final double Y) { 32 | x = X; 33 | y = Y; 34 | } 35 | 36 | 37 | // ******************** Methods ******************************************* 38 | public double getX() { return x; } 39 | public void setX(final double X) { x = X; } 40 | 41 | public double getY() { return y; } 42 | public void setY(final double Y) { y = Y; } 43 | 44 | public void set(final Point POINT) { 45 | set(POINT.x, POINT.y); 46 | } 47 | public void set(final double X, final double Y) { 48 | x = X; 49 | y = Y; 50 | } 51 | 52 | public double distanceSquareTo(final Point P) { return distanceSquare(P.getX(), P.getY(), x, y); } 53 | public double distanceTo(final Point P) { return distance(P.getX(), P.getY(), x, y); } 54 | public double distanceTo(final double X, final double Y) { return distance(X, Y, x, y); } 55 | 56 | public static double distance(final Point P1, final Point P2) { return distance(P1.getX(), P1.getY(), P2.getX(), P2.getY()); } 57 | public static double distance(final double X1, final double Y1, final double X2, final double Y2) { 58 | double deltaX = (X2 - X1); 59 | double deltaY = (Y2 - Y1); 60 | return Math.sqrt((deltaX * deltaX) + (deltaY * deltaY)); 61 | } 62 | 63 | public static double distanceSquare(final Point P1, final Point P2) { return distanceSquare(P1.getX(), P1.getY(), P2.getX(), P2.getY()); } 64 | public static double distanceSquare(final double X1, final double Y1, final double X2, final double Y2) { 65 | double deltaX = (X2 - X1); 66 | double deltaY = (Y2 - Y1); 67 | return (deltaX * deltaX) + (deltaY * deltaY); 68 | } 69 | 70 | public int compareTo(final Point POINT) { 71 | return x != POINT.getX() ? Double.compare(x, POINT.x) : Double.compare(y, POINT.y); 72 | } 73 | 74 | @Override public boolean equals(final Object OBJECT) { 75 | if (OBJECT == this) { return true; } 76 | if (OBJECT instanceof Point) { 77 | Point p = (Point) OBJECT; 78 | return (Double.compare(x, p.getX()) == 0 && Double.compare(y, p.getY()) == 0); 79 | } 80 | return false; 81 | } 82 | 83 | @Override public String toString() { 84 | return new StringBuilder().append("x: ").append(x).append(", y: ").append(y).toString(); 85 | } 86 | } -------------------------------------------------------------------------------- /src/main/java/eu/hansolo/fx/geometry/tools/Segment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.geometry.tools; 18 | 19 | import eu.hansolo.fx.geometry.Rectangle; 20 | 21 | 22 | public interface Segment extends Cloneable { 23 | 24 | double minX(); 25 | double maxX(); 26 | 27 | double minY(); 28 | double maxY(); 29 | 30 | Rectangle getBounds2D(); 31 | 32 | Point evalDt(double t); 33 | Point eval(double t); 34 | 35 | Segment getSegment(double t0, double t1); 36 | 37 | SplitResults split(double y); 38 | Segment splitBefore(double t); 39 | Segment splitAfter(double t); 40 | 41 | void subdivide(Segment s0, Segment s1); 42 | void subdivide(double t, Segment s0, Segment s1); 43 | 44 | double getLength(); 45 | double getLength(double maxErr); 46 | 47 | 48 | class SplitResults { 49 | Segment[] above; 50 | Segment[] below; 51 | SplitResults(Segment[] below, Segment[] above) { 52 | this.below = below; 53 | this.above = above; 54 | } 55 | 56 | Segment[] getBelow() { 57 | return below; 58 | } 59 | Segment[] getAbove() { 60 | return above; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module eu.hansolo.fx.charts { 2 | 3 | // Java 4 | requires java.base; 5 | requires java.logging; 6 | 7 | // Java-FX 8 | requires javafx.base; 9 | requires javafx.graphics; 10 | requires javafx.controls; 11 | requires javafx.swing; 12 | 13 | exports eu.hansolo.fx.geometry; 14 | exports eu.hansolo.fx.geometry.tools; 15 | exports eu.hansolo.fx.geometry.transform; 16 | exports eu.hansolo.fx.charts; 17 | exports eu.hansolo.fx.charts.areaheatmap; 18 | exports eu.hansolo.fx.charts.color; 19 | exports eu.hansolo.fx.charts.converter; 20 | exports eu.hansolo.fx.charts.data; 21 | exports eu.hansolo.fx.charts.event; 22 | exports eu.hansolo.fx.charts.font; 23 | exports eu.hansolo.fx.charts.forcedirectedgraph; 24 | exports eu.hansolo.fx.charts.heatmap; 25 | exports eu.hansolo.fx.charts.pareto; 26 | exports eu.hansolo.fx.charts.series; 27 | exports eu.hansolo.fx.charts.tools; 28 | exports eu.hansolo.fx.charts.world; 29 | exports eu.hansolo.fx.charts.voronoi; 30 | } -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/chart.css: -------------------------------------------------------------------------------- 1 | .chart { 2 | -GRAY : rgb(139,144,146); 3 | -RED : rgb(229, 80, 76); 4 | -LIGHT_RED : rgb(255, 84, 56); 5 | -GREEN : rgb(143, 198, 94); 6 | -LIGHT_GREEN : rgb(132, 228, 50); 7 | -BLUE : rgb(55, 179, 252); 8 | -DARK_BLUE : rgb(55, 94, 252); 9 | -ORANGE : rgb(237, 162, 57); 10 | -YELLOW_ORANGE : rgb(229, 198, 76); 11 | -YELLOW : rgb(229, 229, 76); 12 | -MAGENTA : rgb(198, 75, 232); 13 | } 14 | 15 | .chart .xy-chart { 16 | 17 | } 18 | 19 | .chart .xyz-chart { 20 | 21 | } 22 | 23 | .chart .matrix-chart { 24 | 25 | } 26 | 27 | .chart .donut-chart { 28 | 29 | } 30 | 31 | .chart .circular-plot { 32 | 33 | } 34 | 35 | .chart .sankey-plot { 36 | 37 | } 38 | 39 | .chart .axis { 40 | 41 | } 42 | 43 | .concentric-ring-chart { 44 | 45 | } 46 | 47 | .comparison-ring-chart { 48 | 49 | } 50 | 51 | .voronoi-chart { 52 | 53 | } -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/font/Lato-Bol.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/main/resources/eu/hansolo/fx/charts/font/Lato-Bol.otf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/font/Lato-Lig.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/main/resources/eu/hansolo/fx/charts/font/Lato-Lig.otf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/font/Lato-Reg.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/main/resources/eu/hansolo/fx/charts/font/Lato-Reg.otf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/font/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/main/resources/eu/hansolo/fx/charts/font/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/font/OpenSans-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/main/resources/eu/hansolo/fx/charts/font/OpenSans-ExtraBold.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/font/OpenSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/main/resources/eu/hansolo/fx/charts/font/OpenSans-Light.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/font/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/main/resources/eu/hansolo/fx/charts/font/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/font/OpenSans-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/main/resources/eu/hansolo/fx/charts/font/OpenSans-Semibold.ttf -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/world/custom-styles.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .world { 18 | -background-color: #4aa9d7; 19 | -fill-color : #dcb36c; 20 | -stroke-color : #987028; 21 | -hover-color : #fec47e; 22 | -pressed-color : #6cee85; 23 | -selected-color : magenta; 24 | -location-color : blue; 25 | } -------------------------------------------------------------------------------- /src/main/resources/eu/hansolo/fx/charts/world/world.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .world { 18 | -background-color: #3f3f4f; 19 | -fill-color : #d9d9dc; 20 | -stroke-color : #000000; 21 | -hover-color : #456acf; 22 | -pressed-color : #789dff; 23 | -selected-color : #9dff78; 24 | -location-color : #FF0000; 25 | } 26 | -------------------------------------------------------------------------------- /src/test/.gradle/3.3/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/test/.gradle/3.3/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /src/test/.gradle/3.3/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/test/.gradle/3.3/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /src/test/.gradle/3.3/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/test/.gradle/3.3/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /src/test/.gradle/3.3/taskArtifacts/taskArtifacts.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/test/.gradle/3.3/taskArtifacts/taskArtifacts.lock -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/ArcChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class ArcChartTestLauncher { 20 | public static void main(String[] args) { ArcChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/AreaHeatMapTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | import eu.hansolo.fx.charts.areaheatmap.AreaHeatMap; 20 | import eu.hansolo.fx.charts.areaheatmap.AreaHeatMap.Quality; 21 | import eu.hansolo.fx.charts.areaheatmap.AreaHeatMapBuilder; 22 | import eu.hansolo.fx.charts.data.DataPoint; 23 | import eu.hansolo.fx.charts.tools.ColorMapping; 24 | import javafx.application.Application; 25 | import javafx.stage.Stage; 26 | import javafx.scene.layout.StackPane; 27 | import javafx.scene.Scene; 28 | 29 | import java.util.ArrayList; 30 | import java.util.List; 31 | import java.util.Random; 32 | 33 | 34 | /** 35 | * User: hansolo 36 | * Date: 22.11.17 37 | * Time: 19:55 38 | */ 39 | public class AreaHeatMapTest extends Application { 40 | private static final Random RND = new Random(); 41 | private AreaHeatMap areaHeatMap; 42 | 43 | @Override public void init() { 44 | List randomPoints = new ArrayList<>(29); 45 | //randomPoints.add(new DataPoint(0, 0, 0)); 46 | //randomPoints.add(new DataPoint(400, 0, 0)); 47 | //randomPoints.add(new DataPoint(400, 400, 0)); 48 | //randomPoints.add(new DataPoint(0, 400, 0)); 49 | for (int counter = 0 ; counter < 25 ; counter++) { 50 | double x = RND.nextDouble() * 400; 51 | double y = RND.nextDouble() * 400; 52 | double v = RND.nextDouble() * 100 - 50; 53 | randomPoints.add(new DataPoint(x, y, v)); 54 | } 55 | 56 | areaHeatMap = AreaHeatMapBuilder.create() 57 | .prefSize(400, 400) 58 | .colorMapping(ColorMapping.BLUE_CYAN_GREEN_YELLOW_RED) 59 | .quality(Quality.FINE) 60 | .heatMapOpacity(0.5) 61 | .useColorMapping(true) 62 | .dataPointsVisible(true) 63 | .noOfCloserInfluentPoints(5) 64 | .dataPoints(randomPoints) 65 | .build(); 66 | } 67 | 68 | @Override public void start(Stage stage) { 69 | StackPane pane = new StackPane(areaHeatMap); 70 | 71 | Scene scene = new Scene(pane); 72 | 73 | stage.setTitle("Area HeatMap"); 74 | stage.setScene(scene); 75 | stage.show(); 76 | } 77 | 78 | @Override public void stop() { 79 | System.exit(0); 80 | } 81 | 82 | public static void main(String[] args) { 83 | launch(args); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/AreaHeatMapTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class AreaHeatMapTestLauncher { 20 | public static void main(String[] args) { AreaHeatMapTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/AxisTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | import eu.hansolo.fx.charts.converter.Converter; 20 | import eu.hansolo.fx.charts.tools.Helper; 21 | import javafx.application.Application; 22 | import javafx.geometry.Insets; 23 | import javafx.geometry.Orientation; 24 | import javafx.scene.layout.AnchorPane; 25 | import javafx.stage.Stage; 26 | import javafx.scene.Scene; 27 | 28 | import static eu.hansolo.fx.charts.converter.Converter.Category.*; 29 | import static eu.hansolo.fx.charts.converter.Converter.UnitDefinition.*; 30 | 31 | 32 | /** 33 | * User: hansolo 34 | * Date: 22.07.17 35 | * Time: 14:12 36 | */ 37 | public class AxisTest extends Application { 38 | private static final double AXIS_WIDTH = 20; 39 | private static final double AXIS_HEIGHT = 20; 40 | private Axis xAxisBottom; 41 | private Axis xAxisTop; 42 | private Axis yAxisLeft; 43 | private Axis yAxisRight; 44 | 45 | 46 | @Override public void init() { 47 | xAxisBottom = Helper.createBottomAxis(-20, 20, AXIS_HEIGHT); 48 | xAxisTop = Helper.createTopAxis(0, 100, AXIS_HEIGHT); 49 | yAxisLeft = Helper.createLeftAxis(-20, 20, AXIS_WIDTH); 50 | 51 | Converter tempConverter = new Converter(TEMPERATURE, CELSIUS); // Type Temperature with BaseUnit Celsius 52 | double tempFahrenheitMin = tempConverter.convert(-20, FAHRENHEIT); 53 | double tempFahrenheitMax = tempConverter.convert(20, FAHRENHEIT); 54 | yAxisRight = Helper.createRightAxis(tempFahrenheitMin, tempFahrenheitMax, false, AXIS_WIDTH); 55 | 56 | AnchorPane.setTopAnchor(yAxisLeft, AXIS_HEIGHT); 57 | AnchorPane.setTopAnchor(xAxisTop, 0d); 58 | AnchorPane.setTopAnchor(yAxisRight, AXIS_HEIGHT); 59 | } 60 | 61 | @Override public void start(Stage stage) { 62 | AnchorPane pane = new AnchorPane(xAxisBottom, xAxisTop, yAxisLeft, yAxisRight); 63 | pane.setPadding(new Insets(10)); 64 | pane.setPrefSize(400, 400); 65 | 66 | Scene scene = new Scene(pane); 67 | 68 | stage.setTitle("Axis Test"); 69 | stage.setScene(scene); 70 | stage.show(); 71 | } 72 | 73 | @Override public void stop() { 74 | System.exit(0); 75 | } 76 | 77 | public static void main(String[] args) { 78 | launch(args); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/AxisTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class AxisTestLauncher { 20 | public static void main(String[] args) { AxisTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/BubbleGridChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts; 20 | 21 | public class BubbleGridChartTestLauncher { 22 | public static void main(String[] args) { BubbleGridChartTest.main(args); } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/ChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class ChartTestLauncher { 20 | public static void main(String[] args) { ChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/CircularPlotTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class CircularPlotTestLauncher { 20 | public static void main(String[] args) { CircularPlotTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/ComparisonRingChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class ComparisonRingChartTestLauncher { 20 | public static void main(String[] args) { ComparisonRingChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/ConcentricRingChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class ConcentricRingChartTestLauncher { 20 | public static void main(String[] args) { ConcentricRingChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/CoxcombChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class CoxcombChartTestLauncher { 20 | public static void main(String[] args) { CoxcombChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/EmptyItemTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts; 20 | 21 | public class EmptyItemTestLauncher { 22 | public static void main(String[] args) { EmptyItemTest.main(args); } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/ForceDirectedGraphTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class ForceDirectedGraphTestLauncher { 20 | public static void main(String[] args) { ForceDirectedGraphTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/GridTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class GridTestLauncher { 20 | public static void main(String[] args) { GridTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/HeatMapTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | import eu.hansolo.fx.charts.heatmap.HeatMap; 20 | import eu.hansolo.fx.charts.heatmap.HeatMapBuilder; 21 | import eu.hansolo.fx.charts.heatmap.OpacityDistribution; 22 | import eu.hansolo.fx.charts.tools.ColorMapping; 23 | import javafx.application.Application; 24 | import javafx.scene.input.MouseEvent; 25 | import javafx.stage.Stage; 26 | import javafx.scene.layout.StackPane; 27 | import javafx.scene.Scene; 28 | 29 | 30 | public class HeatMapTest extends Application { 31 | private HeatMap heatMap; 32 | 33 | @Override public void init() { 34 | heatMap = HeatMapBuilder.create() 35 | .prefSize(400, 400) 36 | .colorMapping(ColorMapping.INFRARED_4) 37 | .spotRadius(20) 38 | .opacityDistribution(OpacityDistribution.CUSTOM) 39 | .fadeColors(true) 40 | .build(); 41 | 42 | heatMap.setOnMouseMoved(e -> heatMap.addSpot(e.getX(), e.getY())); 43 | 44 | } 45 | 46 | @Override public void start(Stage stage) { 47 | StackPane pane = new StackPane(heatMap); 48 | 49 | // Setup a mouse event filter which adds spots to the heatmap as soon as the mouse will be moved across the pane 50 | pane.addEventFilter(MouseEvent.MOUSE_MOVED, event -> { 51 | double x = event.getX(); 52 | double y = event.getY(); 53 | if (x < heatMap.getSpotRadius()) x = heatMap.getSpotRadius(); 54 | if (x > pane.getWidth() - heatMap.getSpotRadius()) x = pane.getWidth() - heatMap.getSpotRadius(); 55 | if (y < heatMap.getSpotRadius()) y = heatMap.getSpotRadius(); 56 | if (y > pane.getHeight() - heatMap.getSpotRadius()) y = pane.getHeight() - heatMap.getSpotRadius(); 57 | 58 | heatMap.addSpot(x, y); 59 | }); 60 | pane.widthProperty().addListener((ov, oldWidth, newWidth) -> heatMap.setSize(newWidth.doubleValue(), pane.getHeight())); 61 | pane.heightProperty().addListener((ov, oldHeight, newHeight) -> heatMap.setSize(pane.getWidth(), newHeight.doubleValue())); 62 | 63 | Scene scene = new Scene(pane, 400, 400); 64 | 65 | stage.setTitle("HeatMap (move mouse over pane)"); 66 | stage.setScene(scene); 67 | stage.show(); 68 | } 69 | 70 | @Override public void stop() { 71 | System.exit(0); 72 | } 73 | 74 | public static void main(String[] args) { 75 | launch(args); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/HeatMapTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class HeatMapTestLauncher { 20 | public static void main(String[] args) { HeatMapTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/HorizonChartTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | import eu.hansolo.fx.charts.data.XYItem; 20 | import eu.hansolo.fx.charts.data.XYChartItem; 21 | import eu.hansolo.fx.charts.series.XYSeries; 22 | import javafx.application.Application; 23 | import javafx.stage.Stage; 24 | import javafx.scene.layout.StackPane; 25 | import javafx.scene.Scene; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | import java.util.Random; 30 | 31 | 32 | /** 33 | * User: hansolo 34 | * Date: 13.11.17 35 | * Time: 09:27 36 | */ 37 | public class HorizonChartTest extends Application { 38 | private static final Random RND = new Random(); 39 | private static final int NO_OF_X_VALUES = 1500; 40 | private XYSeries xySeries; 41 | private XYPane xyPane; 42 | 43 | 44 | @Override public void init() { 45 | int bands = 4; 46 | int noOfValues = 1500; 47 | List xyData = new ArrayList<>(noOfValues); 48 | for (int i = 0 ; i < noOfValues; i++) { 49 | double value = Math.abs(Math.cos(i/100.0) + (RND.nextDouble() - 0.5) / 10.0); // Only positive data 50 | xyData.add(new XYChartItem(i, value, "P" + i)); 51 | } 52 | 53 | double minY = xyData.stream().mapToDouble(XYItem::getY).min().getAsDouble(); 54 | double maxY = xyData.stream().mapToDouble(XYItem::getY).max().getAsDouble(); 55 | 56 | xySeries = new XYSeries<>(xyData, ChartType.HORIZON); 57 | 58 | xyPane = new XYPane(bands, xySeries); 59 | xyPane.setPrefSize(400, 30); 60 | xyPane.setLowerBoundX(0); 61 | xyPane.setUpperBoundX(NO_OF_X_VALUES); 62 | xyPane.setLowerBoundY(minY); 63 | xyPane.setUpperBoundY(maxY); 64 | 65 | } 66 | 67 | @Override public void start(Stage stage) { 68 | StackPane pane = new StackPane(xyPane); 69 | 70 | Scene scene = new Scene(pane); 71 | 72 | stage.setTitle("Horizon Chart"); 73 | stage.setScene(scene); 74 | stage.show(); 75 | } 76 | 77 | @Override public void stop() { 78 | System.exit(0); 79 | } 80 | 81 | public static void main(String[] args) { 82 | launch(args); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/HorizonChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class HorizonChartTestLauncher { 20 | public static void main(String[] args) { HorizonChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/LegendTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | import javafx.application.Application; 20 | import javafx.geometry.Orientation; 21 | import javafx.scene.paint.Color; 22 | import javafx.stage.Stage; 23 | import javafx.scene.layout.StackPane; 24 | import javafx.scene.Scene; 25 | 26 | 27 | /** 28 | * User: hansolo 29 | * Date: 05.01.18 30 | * Time: 21:20 31 | */ 32 | public class LegendTest extends Application { 33 | private Legend legend; 34 | 35 | @Override public void init() { 36 | LegendItem item1 = new LegendItem(Symbol.CIRCLE, "Item 1", Color.RED, Color.BLACK); 37 | LegendItem item2 = new LegendItem(Symbol.SQUARE, "Item 2", Color.GREEN, Color.BLACK); 38 | LegendItem item3 = new LegendItem(Symbol.TRIANGLE, "Item 3", Color.BLUE, Color.BLACK); 39 | 40 | legend = new Legend(item1, item2, item3); 41 | legend.setOrientation(Orientation.VERTICAL); 42 | } 43 | 44 | @Override public void start(Stage stage) { 45 | StackPane pane = new StackPane(legend); 46 | 47 | Scene scene = new Scene(pane); 48 | 49 | stage.setTitle("Legend"); 50 | stage.setScene(scene); 51 | stage.show(); 52 | } 53 | 54 | @Override public void stop() { 55 | System.exit(0); 56 | } 57 | 58 | public static void main(String[] args) { 59 | launch(args); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/LegendTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class LegendTestLauncher { 20 | public static void main(String[] args) { LegendTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/LineChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class LineChartTestLauncher { 20 | public static void main(String[] args) { LineChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/LogAxisTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | import javafx.application.Application; 20 | import javafx.geometry.Insets; 21 | import javafx.geometry.Orientation; 22 | import javafx.scene.layout.AnchorPane; 23 | import javafx.stage.Stage; 24 | import javafx.scene.Scene; 25 | 26 | 27 | /** 28 | * User: hansolo 29 | * Date: 08.08.17 30 | * Time: 14:16 31 | */ 32 | public class LogAxisTest extends Application { 33 | private Axis xAxisBottom; 34 | private Axis yAxisLeft; 35 | private Axis logAxisX; 36 | 37 | 38 | @Override public void init() { 39 | xAxisBottom = new Axis(0, 1000, Orientation.HORIZONTAL, AxisType.LOGARITHMIC, Position.BOTTOM); 40 | xAxisBottom.setPrefHeight(20); 41 | AnchorPane.setLeftAnchor(xAxisBottom, 20d); 42 | AnchorPane.setRightAnchor(xAxisBottom, 20d); 43 | AnchorPane.setBottomAnchor(xAxisBottom, 0d); 44 | 45 | yAxisLeft = new Axis(0, 1000, Orientation.VERTICAL, AxisType.LOGARITHMIC, Position.LEFT); 46 | yAxisLeft.setPrefWidth(20); 47 | AnchorPane.setLeftAnchor(yAxisLeft, 0d); 48 | AnchorPane.setTopAnchor(yAxisLeft, 20d); 49 | AnchorPane.setBottomAnchor(yAxisLeft, 20d); 50 | } 51 | 52 | @Override public void start(Stage stage) { 53 | AnchorPane pane = new AnchorPane(xAxisBottom, yAxisLeft); 54 | pane.setPadding(new Insets(10)); 55 | pane.setPrefSize(400, 400); 56 | 57 | Scene scene = new Scene(pane); 58 | 59 | stage.setTitle("Title"); 60 | stage.setScene(scene); 61 | stage.show(); 62 | } 63 | 64 | @Override public void stop() { 65 | System.exit(0); 66 | } 67 | 68 | public static void main(String[] args) { 69 | launch(args); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/LogAxisTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class LogAxisTestLauncher { 20 | public static void main(String[] args) { LogAxisTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/LogChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class LogChartTestLauncher { 20 | public static void main(String[] args) { LogChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/LogGridTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class LogGridTestLauncher { 20 | public static void main(String[] args) { LogGridTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/MatrixHeatmapTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class MatrixHeatmapTestLauncher { 20 | public static void main(String[] args) { MatrixHeatmapTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/MatrixPlotTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class MatrixPlotTestLauncher { 20 | public static void main(String[] args) { MatrixPlotTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/MultiTimeSeriesTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts; 20 | 21 | public class MultiTimeSeriesTestLauncher { 22 | public static void main(String[] args) { MultiTimeSeriesTest.main(args); } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/NestedBarChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class NestedBarChartTestLauncher { 20 | public static void main(String[] args) { NestedBarChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/ParallelCoordinatesChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class ParallelCoordinatesChartTestLauncher { 20 | public static void main(String[] args) { ParallelCoordinatesChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/ParetoTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class ParetoTestLauncher { 20 | public static void main(String[] args) { ParetoTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/PlayfairTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class PlayfairTestLauncher { 20 | public static void main(String[] args) { PlayfairTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/PolarChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class PolarChartTestLauncher { 20 | public static void main(String[] args) { PolarChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/RadarChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class RadarChartTestLauncher { 20 | public static void main(String[] args) { RadarChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/RidgeLineChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class RidgeLineChartTestLauncher { 20 | public static void main(String[] args) { RidgeLineChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/SankeyPlotTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class SankeyPlotTestLauncher { 20 | public static void main(String[] args) { SankeyPlotTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/SectorChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts; 20 | 21 | public class SectorChartTestLauncher { 22 | public static void main(String[] args) { SectorChartTest.main(args); } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/SingleChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class SingleChartTestLauncher { 20 | public static void main(String[] args) { SingleChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/StreamChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class StreamChartTestLauncher { 20 | public static void main(String[] args) { StreamChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/SunburstChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class SunburstChartTestLauncher { 20 | public static void main(String[] args) { SunburstChartTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/TimeAxisTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class TimeAxisTestLauncher { 20 | public static void main(String[] args) { TimeAxisTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/VoronoiChartTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts; 20 | 21 | import eu.hansolo.fx.charts.voronoi.VPoint; 22 | import eu.hansolo.fx.charts.voronoi.VoronoiChart; 23 | import eu.hansolo.fx.charts.voronoi.VoronoiChart.Type; 24 | import eu.hansolo.fx.charts.voronoi.VoronoiChartBuilder; 25 | import javafx.application.Application; 26 | import javafx.scene.Scene; 27 | import javafx.scene.layout.StackPane; 28 | import javafx.scene.paint.Color; 29 | import javafx.stage.Stage; 30 | 31 | import java.util.ArrayList; 32 | import java.util.List; 33 | import java.util.Random; 34 | 35 | 36 | public class VoronoiChartTest extends Application { 37 | private static final Random RND = new Random(); 38 | private static final double WIDTH = 600; 39 | private static final double HEIGHT = 600; 40 | private VoronoiChart voronoiChart; 41 | 42 | 43 | @Override public void init() { 44 | List vPoints = new ArrayList<>(); 45 | for (int i = 0 ; i < 25 ; i++) { 46 | vPoints.add(new VPoint(RND.nextDouble() * WIDTH, RND.nextDouble() * HEIGHT)); 47 | } 48 | 49 | voronoiChart = VoronoiChartBuilder.create() 50 | .prefSize(WIDTH, HEIGHT) 51 | .type(Type.VORONOI) // Type of diagram (VORONOI, DELAUNY) 52 | .borderColor(Color.BLACK) // Color of line between regions 53 | .multiColor(true) // Randomly created fill colors for regions 54 | .pointsVisible(true) // Points visible 55 | .pointColor(Color.BLACK) // Color of points 56 | .fillRegions(true) // Fill regions, otherwise only the borders will be visible 57 | .interactive(true) // When true new points can be added by clicking in the diagram 58 | .voronoiColor(Color.ORANGERED) // Fill color for voronoi regions if multicolor == false 59 | .delaunayColor(Color.YELLOWGREEN) // Fill color for delauny regions if multicolor == false 60 | .points(vPoints) 61 | .build(); 62 | 63 | registerListener(); 64 | } 65 | 66 | private void registerListener() { 67 | 68 | } 69 | 70 | @Override public void start(Stage stage) { 71 | StackPane pane = new StackPane(voronoiChart); 72 | Scene scene = new Scene(pane); 73 | 74 | stage.setTitle("VoronoiChart"); 75 | stage.setScene(scene); 76 | stage.show(); 77 | } 78 | 79 | @Override public void stop() { 80 | System.exit(0); 81 | } 82 | 83 | public static void main(String[] args) { 84 | launch(args); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/VoronoiChartTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * Copyright 2016-2021 Gerrit Grunwald. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package eu.hansolo.fx.charts; 20 | 21 | public class VoronoiChartTestLauncher { 22 | public static void main(String[] args) { VoronoiChartTest.main(args); } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/WorldHeatMapTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class WorldHeatMapTestLauncher { 20 | public static void main(String[] args) { WorldHeatMapTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/eu/hansolo/fx/charts/WorldmapConnectionsTestLauncher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 by Gerrit Grunwald 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.hansolo.fx.charts; 18 | 19 | public class WorldmapConnectionsTestLauncher { 20 | public static void main(String[] args) { WorldmapConnectionsTest.main(args); } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/eu/hansolo/fx/charts/plane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HanSolo/charts/f9210ad4b08d52519be087c7aaae5108da6de1d8/src/test/resources/eu/hansolo/fx/charts/plane.png -------------------------------------------------------------------------------- /src/test/resources/eu/hansolo/fx/charts/tooltip.css: -------------------------------------------------------------------------------- 1 | .charts-tooltip { 2 | -fx-background-color: white; 3 | } 4 | .charts-tooltip .label { 5 | -fx-text-fill: red; 6 | -fx-font-weight: bold; 7 | -fx-font-family: 'Helvetica', Arial, sans-serif; 8 | } 9 | --------------------------------------------------------------------------------