Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container-fluid mb-3">
  <div class="row pt-5 pl-3 pr-3">
    <div class="col">
      <div class="card shadow border">
        <div class="card-body">
          <div class="mr-5 ml-5 text-center mb-2">
            <div class="alert alert-primary">
              <strong>
                Use
                <code style="font-size: 18px; font-weight: 600">+</code>
                &
                <code style="font-size: 18px; font-weight: 600">-</code>
                buttons to adjust canvas padding on top, left, bottom and
                right!</strong
              >
            </div>
          </div>
          <div class="control-panel text-center pb-3">
            <button id="sub-top-btn" class="btn btn-secondary-grad btn-sm mr-1">
              -
            </button>
            <label id="top-val">-</label>
            <button id="add-top-btn" class="btn btn-secondary-grad btn-sm ml-1">
              +
            </button>
          </div>
          <div class="row">
            <div class="col-1 aligner text-center">
              <div class="control-panel align-item">
                <button
                  id="add-left-btn"
                  class="btn btn-secondary-grad btn-sm mt-1"
                >
                  +
                </button>
                <br />
                <label id="left-val">-</label><br />
                <button
                  id="sub-left-btn"
                  class="btn btn-secondary-grad btn-sm mb-1"
                >
                  -
                </button>
              </div>
            </div>
            <div class="col-10">
              <div id="chart-container" class="border"></div>
            </div>
            <div class="col-1 aligner">
              <div class="control-panel align-item text-center">
                <button
                  id="add-right-btn"
                  class="btn btn-secondary-grad btn-sm mt-1"
                >
                  +
                </button>
                <br />
                <label id="right-val">-</label><br />
                <button
                  id="sub-right-btn"
                  class="btn btn-secondary-grad btn-sm mb-1"
                >
                  -
                </button>
              </div>
            </div>
          </div>
          <div class="control-panel text-center pt-3">
            <button
              id="sub-bottom-btn"
              class="btn btn-secondary-grad btn-sm mr-1"
            >
              -
            </button>
            <label id="bottom-val">-</label>
            <button
              id="add-bottom-btn"
              class="btn btn-secondary-grad btn-sm ml-1"
            >
              +
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

              
            
!

CSS

              
                #chart-container {
  height: 450px;
}

.aligner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.aligner-item {
  max-width: 50%;
}
              
            
!

JS

              
                const dataSource = {
  chart: {
    theme: "fusion",
    caption: "Sales & Profit Analysis",
    subcaption: "For Last Quarter",
    xaxisminvalue: "0",
    xaxismaxvalue: "100",
    yaxisminvalue: "0",
    yaxismaxvalue: "30000",
    xaxisname: "Average Price",
    yaxisname: "Units Sold",
    plottooltext: "$name : Profit Contribution: $zvalue%",
    drawquadrant: "1",
    quadrantlabeltl: "Low Price / High Sales",
    quadrantlabeltr: "High Price / High Sales",
    quadrantlabelbl: "Low Price / Low Sales",
    quadrantlabelbr: "High Price / Low Sales",
    quadrantxval: "54",
    quadrantyval: "12000",
    quadrantlinealpha: "50",
    quadrantlinethickness: "2",
    canvasTopPadding: 0,
    canvasBottomPadding: 0,
    canvasLeftpadding: 0,
    canvasRightPadding: 0,
    showBorder: 1,
    borderColor: "#e9e9ef"
  },
  categories: [
    {
      category: [
        {
          label: "0",
          x: "0"
        },
        {
          label: "$20",
          x: "20",
          showverticalline: "1"
        },
        {
          label: "$40",
          x: "40",
          showverticalline: "1"
        },
        {
          label: "$60",
          x: "60",
          showverticalline: "1"
        },
        {
          label: "$80",
          x: "80",
          showverticalline: "1"
        },
        {
          label: "$100",
          x: "100",
          showverticalline: "1"
        }
      ]
    }
  ],
  dataset: [
    {
      data: [
        {
          x: "97",
          y: "15000",
          z: "24",
          name: "Nike"
        },
        {
          x: "60",
          y: "18500",
          z: "26",
          name: "Adidas"
        },
        {
          x: "50",
          y: "29450",
          z: "19",
          name: "Puma"
        },
        {
          x: "65",
          y: "10500",
          z: "8",
          name: "Fila"
        },
        {
          x: "43",
          y: "8750",
          z: "5",
          name: "Lotto"
        },
        {
          x: "32",
          y: "22000",
          z: "10",
          name: "Reebok"
        },
        {
          x: "44",
          y: "13000",
          z: "9",
          name: "Woodland"
        }
      ]
    }
  ],
  trendlines: [
    {
      line: [
        {
          startvalue: "20000",
          endvalue: "30000",
          istrendzone: "1",
          color: "#aaaaaa",
          alpha: "14"
        },
        {
          startvalue: "10000",
          endvalue: "20000",
          istrendzone: "1",
          color: "#aaaaaa",
          alpha: "7"
        }
      ]
    }
  ]
};

FusionCharts.ready(function() {
  let topLbl = document.getElementById("top-val");

  let bottomLbl = document.getElementById("bottom-val");

  let leftLbl = document.getElementById("left-val");

  let rightLbl = document.getElementById("right-val");

  var myChart = new FusionCharts({
    type: "bubble",
    renderAt: "chart-container",
    width: "100%",
    height: "100%",
    dataFormat: "json",
    dataSource
  }).render();

  myChart.addEventListener("renderComplete", function() {
    topLbl.innerHTML = myChart.getChartAttribute("canvasTopPadding");
    bottomLbl.innerHTML = myChart.getChartAttribute("canvasBottomPadding");
    leftLbl.innerHTML = myChart.getChartAttribute("canvasLeftPadding");
    rightLbl.innerHTML = myChart.getChartAttribute("canvasRightPadding");
  });

  // adding padding on top
  document.getElementById("add-top-btn").addEventListener("click", function() {
    let topPaddingVal = parseInt(myChart.getChartAttribute("canvasTopPadding"));
    myChart.setChartAttribute("canvasTopPadding", topPaddingVal + 1);
    topLbl.innerHTML = topPaddingVal + 1;
  });

  // reducing padding on top
  document.getElementById("sub-top-btn").addEventListener("click", function() {
    let topPaddingVal = parseInt(myChart.getChartAttribute("canvasTopPadding"));
    if (topPaddingVal > 0) {
      myChart.setChartAttribute("canvasTopPadding", topPaddingVal - 1);
      topLbl.innerHTML = topPaddingVal - 1;
    } else {
      alert("Top padding can't be less than 0.");
    }
  });

  // adding padding on left
  document.getElementById("add-left-btn").addEventListener("click", function() {
    let leftPaddingVal = parseInt(
      myChart.getChartAttribute("canvasLeftPadding")
    );
    myChart.setChartAttribute("canvasLeftPadding", leftPaddingVal + 1);
    leftLbl.innerHTML = leftPaddingVal + 1;
  });

  // reducing padding on left
  document.getElementById("sub-left-btn").addEventListener("click", function() {
    let leftPaddingVal = parseInt(
      myChart.getChartAttribute("canvasLeftPadding")
    );
    if (leftPaddingVal > 0) {
      myChart.setChartAttribute("canvasLeftPadding", leftPaddingVal - 1);
      leftLbl.innerHTML = leftPaddingVal - 1;
    } else {
      alert("Left padding can't be less than 0.");
    }
  });

  // adding padding on bottom
  document
    .getElementById("add-bottom-btn")
    .addEventListener("click", function() {
      let bottomPaddingVal = parseInt(
        myChart.getChartAttribute("canvasBottomPadding")
      );
      myChart.setChartAttribute("canvasBottomPadding", bottomPaddingVal + 1);
      bottomLbl.innerHTML = bottomPaddingVal + 1;
    });

  // reducing padding on bottom
  document
    .getElementById("sub-bottom-btn")
    .addEventListener("click", function() {
      let bottomPaddingVal = parseInt(
        myChart.getChartAttribute("canvasBottomPadding")
      );
      if (bottomPaddingVal > 0) {
        myChart.setChartAttribute("canvasBottomPadding", bottomPaddingVal - 1);
        bottomLbl.innerHTML = bottomPaddingVal - 1;
      } else {
        alert("Bottom padding can't be less than 0.");
      }
    });

  // adding padding on right
  document
    .getElementById("add-right-btn")
    .addEventListener("click", function() {
      let rightPaddingVal = parseInt(
        myChart.getChartAttribute("canvasRightPadding")
      );
      myChart.setChartAttribute("canvasRightPadding", rightPaddingVal + 1);
      leftLbl.innerHTML = rightPaddingVal + 1;
    });

  // reducing padding on right
  document
    .getElementById("sub-right-btn")
    .addEventListener("click", function() {
      let rightPaddingVal = parseInt(
        myChart.getChartAttribute("canvasrightPadding")
      );
      if (rightPaddingVal > 0) {
        myChart.setChartAttribute("canvasrightPadding", rightPaddingVal - 1);
        leftLbl.innerHTML = rightPaddingVal - 1;
      } else {
        alert("Right padding can't be less than 0.");
      }
    });
});

              
            
!
999px

Console