I want to mark points of intersection of two lines in x-y plane on a graph..
Using GraphView in my app, I have plotted 2 series in following manner:
GraphView graph = (GraphView) findViewById(R.id.graph);
graph.getViewport().setScalable(true);
graph.getViewport().setScrollable(true);
graph.getViewport().setScalableY(true);
graph.getViewport().setScrollableY(false);
PointsGraphSeries<DataPoint> series1 = new PointsGraphSeries<>(new DataPoint[]{
new DataPoint(3, 4),
new DataPoint(4, 4.1),
new DataPoint(5, 4.1),
new DataPoint(6, 4.2),
new DataPoint(7, 4.2),
new DataPoint(8, 4.3),
new DataPoint(9, 4.3),
new DataPoint(10, 4.4),
new DataPoint(10, 4.4),
new DataPoint(10, 4.5),
new DataPoint(11, 4.5),
new DataPoint(12, 4.5),
new DataPoint(12, 4.6),
new DataPoint(13, 4.6),
new DataPoint(14, 4.6),
new DataPoint(15, 4.7),
new DataPoint(16, 4.8),
new DataPoint(16, 5.0),
new DataPoint(17, 5.0),
new DataPoint(18, 5.1),
new DataPoint(19, 5.4),
new DataPoint(20, 5.5),
new DataPoint(21, 5.6),
new DataPoint(22, 5.6),
new DataPoint(25, 5.7),
new DataPoint(26, 5.7),
new DataPoint(27, 5.8),
new DataPoint(28, 5.8),
new DataPoint(29, 5.9),
new DataPoint(30, 5.9),
new DataPoint(30, 6.0),
new DataPoint(31, 6.0),
new DataPoint(32, 6.0)
});
graph.addSeries(series1);
series1.setShape(PointsGraphSeries.Shape.POINT);
series1.setColor(Color.BLACK);
PointsGraphSeries<DataPoint> series2 = new PointsGraphSeries<DataPoint>(new DataPoint[]{
new DataPoint(3, 5),
new DataPoint(4, 4.9),
new DataPoint(5, 4.8),
new DataPoint(6, 4.7),
new DataPoint(7, 4.6),
new DataPoint(8, 4.5),
new DataPoint(9, 4.4),
new DataPoint(10, 4.3),
new DataPoint(11, 4.2),
new DataPoint(12, 4.1),
new DataPoint(13, 4.0),
new DataPoint(14, 3.9),
new DataPoint(15, 3.8),
new DataPoint(16, 3.7),
new DataPoint(17, 3.6),
new DataPoint(18, 3.5),
new DataPoint(19, 3.4),
new DataPoint(20, 3.3),
new DataPoint(21, 3.2),
new DataPoint(22, 3.1),
new DataPoint(23, 3.0),
new DataPoint(24, 2.9),
new DataPoint(25, 2.7),
new DataPoint(26, 2.6),
new DataPoint(27, 2.5),
new DataPoint(28, 2.4),
new DataPoint(29, 2.3),
new DataPoint(30, 2.2),
new DataPoint(31, 2.1),
new DataPoint(32, 2.0),
new DataPoint(33, 1.9),
new DataPoint(34, 1.8),
new DataPoint(35, 1.7),
new DataPoint(36, 1.6),
new DataPoint(37, 1.5),
new DataPoint(38, 1.4),
new DataPoint(39, 1.2),
new DataPoint(40, 1.1),
new DataPoint(42, 0.9),
new DataPoint(43, 0.9),
new DataPoint(44, 1.0),
new DataPoint(45, 1.0),
new DataPoint(46, 1.0),
new DataPoint(47, 1.0),
new DataPoint(48, 1.0),
new DataPoint(49, 1.0),
new DataPoint(50, 1.0),
new DataPoint(51, 1.0),
new DataPoint(52, 1.0),
new DataPoint(53, 1.0),
new DataPoint(54, 1.0),
new DataPoint(55, 1.0),
new DataPoint(56, 1.0),
new DataPoint(57, 1.0),
new DataPoint(58, 1.0),
new DataPoint(59, 1.0),
new DataPoint(60, 1.0),
});
graph.addSeries(series2);
series2.setShape(PointsGraphSeries.Shape.POINT);
series2.setColor(Color.MAGENTA);
Update:- No two DataPoints are equal.
How to mark the intersection of two lines/series in graph with a label?
Is it possible using GraphView / MPAndroidChart or any other library?
Any reply/comment/reference to solution would be greatly appreciated.
I want to implement something similar to as shown in this image:
The intersections here are marked with red-dot and accompany a label.