String cannot be applied to com.org.apache.xpath.internal.operations.String

前端 未结 2 494
南方客
南方客 2021-01-28 08:39

I\'m trying to create a PieChart in JavaFX, and I want to fill it with data from a HashMap.

Here\'s my code:

public Graph(HashM         


        
2条回答
  •  萌比男神i
    2021-01-28 09:31

    this code snippet:

    new PieChart.Data(entry.getKey(), entry.getValue());
    

    entry.getKey() is not string

    String s = entry.getKey();
    new PieChart.Data(s, entry.getValue());
    

    Try it

    https://docs.oracle.com/javase/8/javafx/api/javafx/scene/chart/PieChart.Data.html

提交回复
热议问题