Created
June 22, 2018 02:53
-
-
Save ArsenyMalkov/515f8ddabd5c3e0910c6a151a1fba711 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class CustomTreeDataEntry extends TreeDataEntry { | |
CustomTreeDataEntry(String id, String parent, String product, Integer value) { | |
super(id, parent, value); | |
setValue("product", product); | |
} | |
CustomTreeDataEntry(String id, String parent, String product) { | |
super(id, parent); | |
setValue("product", product); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
List<DataEntry> data = new ArrayList<>(); | |
data.add(new CustomTreeDataEntry("Products by Revenue", null, "Products by Revenue")); | |
data.add(new CustomTreeDataEntry("Fruits", "Products by Revenue", "Fruits", 692000)); | |
data.add(new CustomTreeDataEntry("Vegetables", "Products by Revenue", "Vegetables", 597000)); | |
data.add(new CustomTreeDataEntry("Dairy", "Products by Revenue", "Dairy", 1359000)); | |
data.add(new CustomTreeDataEntry("Meat", "Products by Revenue", "Meat", 596000)); | |
treeMap.setData(data, TreeFillingMethod.AS_TABLE); | |
// Do not forget to indicate fields to return (product, value) | |
treeMap.setOnClickListener(new ListenersInterface.OnClickListener(new String[]{ "product", "value" }) { | |
@Override | |
public void onClick(Event event) { | |
Toast.makeText(TreeMapChartActivity.this, event.getData().get("product") + ":" + event.getData().get("value"), Toast.LENGTH_SHORT).show(); | |
} | |
}); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment