JSFiddle - React, Tailwind, and code Playground
by klsakthi
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
JavaScript
//By altering the values any line should be drawn above the graph
//using the given coordinates
var lineStartXposition = 120,
lineStartYposition = 50,
lineEndXposition = 120,
lineEndYposition = 90;
$(function() {
$('#container').highcharts({
title: {
text: 'REMISSION'
},
xAxis: {
min: 0,
max: 35,
tickInterval: 5,
title: {
text: "Time"
},
},
yAxis: {
min: 0,
max: 100,
tickInterval: 20,
title: {
text: "Survival Probability(%)"
}
},
series: [{
data: [
[1, 100],
[6, 83],
[7, 80],
[9, 75],
[12, 70],
[15, 60],
[20, 50],
[28, 45]
],
step: 'left',
name: 'Group 1'
}, {
data: [
[1, 100],
[5, 75],
[6, 70],
[8, 66],
[10, 61],
[13, 50],
[18, 40],
[25, 32]
],
step: 'left',
name: 'Group 2'
}]
}, function(chart) {
var lineStartXposition2 = chart.series[0].points[3].plotX + chart.plotLeft,
lineStartYposition2 = (chart.series[0].points[3].plotY-50) + chart.plotTop,
lineEndXposition2 = chart.series[0].points[3].plotX + chart.plotLeft,
lineEndYposition2 = (chart.series[0].points[3].plotY+50) + chart.plotTop;
chart.renderer.path(['M', lineStartXposition2, lineStartYposition2, 'L', lineEndXposition2, lineEndYposition2])
.attr({
'stroke-width': 1,
stroke: 'green'
})
.add();
});
});