GraphView
GraphView copied to clipboard
Intersection point for two series
Issue Summary
I want to mark points of intersection of two series on my GraphView implementation
Reproduction Steps
I have plotted 2 series in following manner:
GraphView graph = (GraphView) findViewById(R.id.graph);
// activate horizontal zooming and scrolling
graph.getViewport().setScalable(true);
// activate horizontal scrolling
graph.getViewport().setScrollable(true);
// activate horizontal and vertical zooming and scrolling
graph.getViewport().setScalableY(true);
// activate vertical scrolling
graph.getViewport().setScrollableY(false);
PointsGraphSeries<DataPoint> series1 = new PointsGraphSeries<>(new DataPoint[]{
new DataPoint(3, 4),
new DataPoint(4, 4.1),
new DataPoint(5, 4.2),
new DataPoint(6, 4.3),
new DataPoint(7, 4.4),
new DataPoint(8, 4.4),
new DataPoint(9, 4.4),
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.2),
new DataPoint(13, 4.3),
new DataPoint(14, 4.4),
new DataPoint(15, 4.5),
new DataPoint(16, 4.6),
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);
Expected Behavior
I want to mark the intersection point of both series1 and series2 with a label First Point.
Actual Behavior
Unable to get the intersection of two series.
I am trying to plot 2 lines (Two different lines of different Data Points). But when i add 2nd Series , 1st series get vanished. Please can you help ? how did you plot 2 lines ? @sandeepyohans
@zohaibshan please provide your code.