A waterfall chart is a form of data visualization that helps in understanding the cumulative effect of sequentially introduced positive or negative values. These intermediate values can either be time based or category based.
<!-- 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 = { "x" : { "Status" : ["PD","PD","PD","PD","PD","PD","SD","PD","PD","PD","PD","PD","SD","SD","SD","PR"], "Tissue" : ["Pancreas","Pancreas","Pancreas","Colrectal","Breast","Colrectal","Colrectal","Colrectal","Billiary tract","Colrectal","Esophagus","Billiary tract","Billiary tract","Billiary tract","Colrectal","Billiary tract"] }, "y" : { "data" : [ [115,75,39,23,22,15,12,10,10,10,5,4,2,-8,-11,-31] ], "smps" : ["1001","1002","1003","1004","1005","1006","1007","1008","1009","1010","1011","1012","1013","1014","1015","1016"], "vars" : ["Shrinkage"] } } <-- Create the configuration for the graph --> var config = { "colorBy":"Tissue", "colorScheme":"NEJM", "graphOrientation":"vertical", "graphType":"Bar", "legendInside":"true", "legendKeyBackgroundBorderColor":"rgba(255,255,255,0)", "legendKeyBackgroundColor":"rgba(255,255,255,0)", "legendPosition":"topRight", "showSampleNames":"false", "smpOverlayProperties":{ "Status":{ "position":"bottom", "scheme":"White" } }, "smpOverlays":[ "Status" ], "title":"Clinical Trial", "xAxis2Show":"false", "xAxisTitle":"Best tumor shrinkage (%)" } <!-- Call the CanvasXpress function to create the graph --> var cX = new CanvasXpress("canvasId", data, config); </script>
library(canvasXpress) y=read.table("https://www.canvasxpress.org/data/cX-waterfall2-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) x=read.table("https://www.canvasxpress.org/data/cX-waterfall2-smp.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE) canvasXpress( data=y, smpAnnot=x, colorBy="Tissue", colorScheme="NEJM", graphOrientation="vertical", graphType="Bar", legendInside=TRUE, legendKeyBackgroundBorderColor="rgba(255,255,255,0)", legendKeyBackgroundColor="rgba(255,255,255,0)", legendPosition="topRight", showSampleNames=FALSE, smpOverlayProperties=list(Status=list(position="bottom", scheme="White")), smpOverlays=list("Status"), title="Clinical Trial", xAxis2Show=FALSE, xAxisTitle="Best tumor shrinkage (%)" )