Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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 id="chartDiv" style="max-width: 540px;height: 300px;margin: 0px auto;">
</div> 
              
            
!

CSS

              
                
              
            
!

JS

              
                // JS

var chart = JSC.chart("chartDiv", {
  title_label_text: "Select points",
  debug: true,
  type: "column",
  events_pointSelectionChanged: function syncAllCheckbox() {
     //If all points are selected or cleared, this syncs the checkAll checkbox.
    var chart = this;
    var allPoints = chart.series().points().items.length;
    var selectedPoints = chart.series().points(function (p) {
      return p.options("selected");
    }).items.length;

    //If selected point count equals all points count or if no points are selected.
    if (selectedPoints === allPoints || !selectedPoints) {
      chart
        .legends(0)
        .entries("checkAll")
        .options({ checkbox_checked: !!selectedPoints });
    }
  },
  legend: {
    defaultEntry: {
      // Enable checkboxes for each point legend entry.
      checkbox_enabled: true,
      hoverAction: "none"
    },
    customEntries: [
      {
        id: "checkAll",
        // Position as first entry.
        sortOrder: -1,
        // Enable checkbox. Required since custom entries don't have them by default.
        checkbox_enabled: true,
        // Appearance
        value: "Value",
        name: "Name",
        icon: "none",
        style_fontWeight: "bold",
        // Apply checked state to all points.
        events_click: function () {
          var checked = this.options("checkbox.checked");
          this.chart.series().points().options({ selected: checked });
        }
      }
    ]
  },
  defaultSeries: {
    palette: "default",
    pointSelection: "multiple",
    firstPoint_legendEntry_lineAbove: true
  },

  yAxis_label_text: "Units Sold",
  xAxis_label_text: "Quarter",
  series: [
    {
      name: "A",
      points: [
        { x: "Q1", y: 230 },
        { x: "Q2", y: 240 },
        { x: "Q3", y: 267 },
        { x: "Q4", y: 238 }
      ]
    }
  ]
});

              
            
!
999px

Console