Created
October 17, 2018 04:30
-
-
Save ArsenyMalkov/1129d93053f46d8a0861b9e406dd0fde 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 CustomBubbleDataEntry extends DataEntry { | |
CustomBubbleDataEntry(Integer x, Integer value, Integer signal, String name, String deviceType, String mac) { | |
setValue("x", x); | |
setValue("value", value); | |
setValue("signal", signal); | |
setValue("name", name); | |
setValue("deviceType", deviceType); | |
setValue("mac", mac); | |
} | |
CustomBubbleDataEntry(Integer index, Integer x, Integer value, Integer signal, String name, String deviceType, String mac) { | |
setValue("index", index); | |
setValue("x", x); | |
setValue("value", value); | |
setValue("signal", signal); | |
setValue("name", name); | |
setValue("deviceType", deviceType); | |
setValue("mac", mac); | |
} | |
} |
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
AnyChartView anyChartView = findViewById(R.id.any_chart_view); | |
Polar chart = AnyChart.polar(); | |
List<DataEntry> data = new ArrayList<>(); | |
data.add(new CustomBubbleDataEntry(0, 0, 0, "WiFi hotspot", "wifi", "BF-AD-3A-36-A4-BE")); | |
data.add(new CustomBubbleDataEntry(1, 0, 2, -8, "iPhone X", "phone", "D6-18-CD-D4-DE-D2")); | |
data.add(new CustomBubbleDataEntry(2, 90, 4, -35, "Samsung s8", "phone", "03-ED-5C-E2-76-F4")); | |
data.add(new CustomBubbleDataEntry(3, 50, 4, -47, "Oneplus3T", "phone", "49-5C-D8-54-5A-5B")); | |
data.add(new CustomBubbleDataEntry(4, 120, 8,-72, "Nokia 6", "phone", "C5-F4-29-05-67-0D")); | |
data.add(new CustomBubbleDataEntry(5,170, 2, -12, "Samsung Note9", "phone", "91-72-36-E5-C1-0C")); | |
data.add(new CustomBubbleDataEntry(6, 200, 4, -37, "iPhone XS", "phone", "F5-C3-0F-2B-C8-AE")); | |
data.add(new CustomBubbleDataEntry(7, 210, 2, -20, "Dell XPS", "laptop", "44-99-CF-1E-61-CD")); | |
data.add(new CustomBubbleDataEntry(8, 300, 4, -42, "Apple MBP", "laptop", "2A-76-AC-F0-52-89")); | |
data.add(new CustomBubbleDataEntry(9, 100, 2, -25, "Lenovo Tab3", "tablet", "6B-CC-F8-E8-21-6C")); | |
Marker series = chart.marker(data); | |
series.type(MarkerType.CIRCLE); | |
String placeImages = "function placeImages() {" + | |
" var src;" + | |
" if (this.getData('deviceType') === 'phone')" + | |
" src = 'https://image.flaticon.com/icons/svg/65/65680.svg';" + | |
" if (this.getData('deviceType') === 'laptop')" + | |
" src = 'https://image.flaticon.com/icons/png/128/59/59505.png';" + | |
" if (this.getData('deviceType') === 'tablet')" + | |
" src = 'https://cdn2.iconfinder.com/data/icons/font-awesome/1792/tablet-128.png';" + | |
" if (this.getData('deviceType') === 'wifi')" + | |
" src = 'https://image.flaticon.com/icons/png/128/34/34143.png';" + | |
" return {" + | |
" src: src," + | |
" mode: 'fit'," + | |
" opacity: 1" + | |
" }" + | |
" }"; | |
series.normal().fill(placeImages); | |
series.normal().size(15).stroke(null); | |
series.hovered().size(17); | |
series.selected().size(17); | |
series.selected().fill(placeImages).stroke("3 #0f4b86"); | |
series.labels(true); | |
series.labels() | |
.anchor(Anchor.CENTER) | |
.offsetY(-2) | |
.fontSize(12) | |
.fontColor("white") | |
.format("function() { return this.getData('index'); }"); | |
chart.yGrid(0).palette("[['#70e952 0.8', '#61da44 0.8'], ['#6cd053 0.8', '#39d811 0.8'], ['#46978d 0.8', '#05bda5 0.8'], ['#274553 0.8', '#01638f 0.8'], ['#28323c 0.8', '#596985 0.8']]"); | |
chart.yGrid(0).stroke("6 black"); | |
chart.xGrid(false); | |
chart.xScale().maximum(360); | |
chart.yScale() | |
.maximum(9) | |
.minimum(0); | |
((Linear) chart.yScale(Linear.class)).ticks("[0, 1, 3, 5, 7, 9]"); | |
chart.xAxis(false); | |
chart.yAxis(false); | |
chart.yAxis().stroke(null); | |
chart.background("#1f2429"); | |
chart.tooltip().format("Singnal strenthg: {%signal} dB\\nMAC address: {%mac}"); | |
chart.tooltip().titleFormat("{%name}"); | |
anyChartView.setChart(chart); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment