AreaLine Chart

A combination of area and line graphs.


Example Color Themes

Example Fonts

Show Code

Tools

<html>

  <head>
    <!-- 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/dist/canvasXpress.min.js"></script>
  </head>

  <body>

    <!-- 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" : [
              [10,11,13,4,18,21],
              [5,8,10,12,15,10],
              [2,3,6,4,8,6],
              [18,27,29,21,42,37],
              [6,9,9,6,14,12]
            ],
            "smps" : ["Jan","Feb","Mar","Apr","May","Jun"],
            "vars" : ["Series A","Series B","Series C","Series D","Series E"]
         }
      }

      // Create the configuration for the graph
      var config = {
         "colors" : ["rgb(160,81,149)","rgb(47,75,124)","rgb(102,81,145)","rgb(255,166,0)","rgb(0,63,92)","rgb(160,81,149)"],
         "graphOrientation" : "vertical",
         "graphType" : "AreaLine",
         "legendPosition" : "topRight",
         "lineThickness" : 3,
         "lineType" : "spline",
         "setMinX" : 0,
         "setMinX2" : 0,
         "smpTextRotate" : 90,
         "smpTitle" : "Month",
         "xAxis" : ["Series A"],
         "xAxis2" : ["Series D"],
         "xAxis2Show" : true,
         "xAxis2Title" : "Value2",
         "xAxisShow" : true,
         "xAxisTitle" : "Value"
      }

      // Event used to create graph (optional)
      var events = false


      // Call the CanvasXpress function to create the graph
      var cX = new CanvasXpress("canvasId", data, config, events);

      
    </script>

  </body>

</html>
library(canvasXpress)
y=read.table("https://www.canvasxpress.org/data/r/cX-area8-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
  data=y,
  colors=list("rgb(160,81,149)", "rgb(47,75,124)", "rgb(102,81,145)", "rgb(255,166,0)", "rgb(0,63,92)", "rgb(160,81,149)"),
  graphOrientation="vertical",
  graphType="AreaLine",
  legendPosition="topRight",
  lineThickness=3,
  lineType="spline",
  setMinX=0,
  setMinX2=0,
  smpTextRotate=90,
  smpTitle="Month",
  xAxis=list("Series A"),
  xAxis2=list("Series D"),
  xAxis2Show=TRUE,
  xAxis2Title="Value2",
  xAxisShow=TRUE,
  xAxisTitle="Value"
)