Skip to content

Commit

Permalink
Fix for issue #62 Adding more than 4 Chart Data's into a radial chart…
Browse files Browse the repository at this point in the history
… breaks
  • Loading branch information
HanSolo committed Oct 31, 2018
1 parent 4b201d3 commit d1e25d1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/main/java/eu/hansolo/tilesfx/skins/RadialChartTileSkin.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,18 @@ public RadialChartTileSkin(final Tile TILE) {
};

clickHandler = e -> {
double x = e.getX();
double y = e.getY();
double startAngle = 90;
List<ChartData> dataList = tile.getChartData();
int noOfItems = dataList.size();
double canvasSize = chartCanvas.getWidth();
double barWidth = canvasSize * 0.1;
double max = noOfItems == 0 ? 0 : dataList.stream().max(Comparator.comparingDouble(ChartData::getValue)).get().getValue();
System.out.println("clicked");
double x = e.getX();
double y = e.getY();
double startAngle = 90;
List<ChartData> dataList = tile.getChartData();
int noOfItems = dataList.size();
double canvasSize = chartCanvas.getWidth();
double radius = canvasSize * 0.5;
double innerSpacer = radius * 0.18;
double barWidth = (radius - innerSpacer) / tile.getChartData().size();
double max = noOfItems == 0 ? 0 : dataList.stream().max(Comparator.comparingDouble(ChartData::getValue)).get().getValue();

for (int i = 0 ; i < noOfItems ; i++) {
ChartData data = dataList.get(i);
double value = clamp(0, Double.MAX_VALUE, data.getValue());
Expand Down

0 comments on commit d1e25d1

Please sign in to comment.