Kaplan-Meier Chart

The Kaplan–Meier estimator, also known as the product limit estimator, is a non-parametric statistic used to estimate the survival function from lifetime data. In medical research, it is often used to measure the fraction of patients living for a certain amount of time after treatment.


Example Color Themes

Example Fonts



Show Code

Tools

<!-- Include the CanvasXpress library in your HTML file -->
<link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/>
<script src="https://www.canvasxpress.org/canvasXpress.min.js"></script>


<!-- Create a canvas element for the chart with the desired dimensions -->
<div>
  <canvas id="canvasId" width="600" height="600"</canvas>
</div>


<!-- Create a script to initialize the chart -->
<script>

  <!-- Create the data for the graph -->
  var data = {
     "y" : {
        "data" : [
          [24,0,1],
          [3,1,0],
          [11,0,1],
          [19,0,1],
          [24,0,1],
          [13,0,1],
          [14,1,0],
          [2,0,1],
          [18,0,1],
          [17,0,1],
          [24,0,1],
          [21,0,1],
          [12,0,1],
          [1,1,0],
          [10,0,1],
          [23,1,0],
          [6,0,1],
          [5,1,0],
          [9,0,1],
          [17,1,0]
        ],
        "smps" : ["Time","Censor","Censor1"],
        "vars" : ["p1","p2","p3","p4","p5","p6","p7","p8","p9","p10","p11","p12","p13","p14","p15","p16","p17","p18","p19","p20"]
     }
  }
  
  
  <-- Create the configuration for the graph -->
  var config = {
     "graphType":"Scatter2D",
     "showDecorations":"true",
     "showKMConfidenceIntervals":"false",
     "showLegend":"false",
     "showTransition":"false",
     "title":"Kaplan-Meier Plot",
     "xAxisTitle":"Weeks",
     "yAxisTitle":"Probability of Survival"
  }
  

  <!-- Call the CanvasXpress function to create the graph -->
  var cX = new CanvasXpress("canvasId", data, config);


  
  <-- Functions after rendering graph -->
  cX.addKMPlot();
  
</script>