Skip to content

Instantly share code, notes, and snippets.

@Shestac92
Created September 28, 2021 03:41
Show Gist options
  • Save Shestac92/6afd66fe7761eaca396e05989e3361a9 to your computer and use it in GitHub Desktop.
Save Shestac92/6afd66fe7761eaca396e05989e3361a9 to your computer and use it in GitHub Desktop.
AnyChartView chart = findViewById(R.id.any_chart_view);
APIlib.getInstance().setActiveAnyChartView(chart);
Cartesian cartesian = AnyChart.line();
cartesian.animation(true);
cartesian.padding(10.0, 20.0, 5.0, 20.0);
cartesian.animation(true);
cartesian.crosshair().enabled(true);
cartesian.crosshair()
.yLabel(true)
.yStroke((Stroke) null, null, null, (String) null, (String) null);
cartesian.tooltip().positionMode(TooltipPositionMode.POINT);
cartesian.xAxis(0).labels().padding(5.0, 5.0, 5.0, 5.0);
cartesian.legend().enabled(false);
cartesian.legend().fontSize(13.0);
cartesian.legend().padding(0.0, 0.0, 10.0, 0.0);
cartesian.xAxis(0).labels().rotation(315);
List<DataEntry> list = new ArrayList<>();
list.add(new ValueDataEntry("Sep 15", 0));
list.add(new ValueDataEntry("Sep 16", 6));
list.add(new ValueDataEntry("Sep 17", 0));
list.add(new ValueDataEntry("Sep 18", 0));
list.add(new ValueDataEntry("Sep 19", 0));
list.add(new ValueDataEntry("Sep 20", 0));
Line series1 = cartesian.line(list);
cartesian.yScale().alignMinimum(true).minimum(0);
series1.hovered().markers().enabled(true);
series1.hovered().markers()
.type(MarkerType.CIRCLE)
.size(8.0).stroke("black 5")
.fill("black");
series1.tooltip()
.position("right")
.anchor(Anchor.LEFT_CENTER)
.offsetX(1.0)
.offsetY(1.0);
MarkersFactory markers = series1.markers();
markers.enabled(true);
markers.fill("#068ccc");
markers.stroke("2 #65a04f");
MarkersFactory hoverMarkers = series1.hovered().markers();
hoverMarkers.fill("darkred");
hoverMarkers.stroke("2 #65a04f");
cartesian.xScroller(true);
cartesian.xScroller().fill("#B5E1F4");
cartesian.xScroller().selectedFill(new GradientKey("#068ccc", 3, 6));
cartesian.xScroller().outlineStroke("#068ccc");
cartesian.xZoom(2);
chart.setChart(cartesian);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment