Threesy module for creating simple, non-time-series line charts.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 310776b Dec 28, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist Removed tooltip activation from code. Dec 27, 2016
example Updated tooltip doc. Dec 27, 2016
src Cleanup. Dec 27, 2016
test Add update function. Dec 22, 2016
.babelrc Add minified build. Dec 20, 2016
.gitignore First commit. Dec 15, 2016 Update readme. Dec 27, 2016
bower.json Add bower installation. Dec 24, 2016
gulpfile.js Updating dist. Dec 27, 2016
index.js Updating dist. Dec 27, 2016
package.json Add tooltip support. Dec 23, 2016


This Threesy module is used to create simple line charts that don't use time-series data. Like other Threesy modules (coming soon), ThreesyLine uses D3 v4 so that it can take advantage of its modularity and only use the modules that are required to make ThreesyLine work. This helps keep file size to a minimum. That said, do not use this module if you require the full functionality of D3.

View example

Get Started

Load the threesy-line script and the very basic CSS directly from Github.

<script src=""></script>
<link rel="stylesheet" href=""> 

Or, install using Bower

bower install --save threesy-line

You do not need to include any other dependencies to start using the threesy-line component and to create a simple line chart.

// Create a new instance of a ThreesyLine chart.
var linechart = new ThreesyLine({
    element: "#chart-container",
    height: 200,
    width: 400,
    data: [
        {x: "Mon", y: 1},
        {x: "Tue", y: 3},
        {x: "Wed", y: 5}

// Draw the chart on the screen.
// Nothing will happen until draw() is invoked.


The ThreesyLine instance can be created by passing in an object to the constructor or without any arguments. You can always set the instance properties after it's been create.


string The id of the HTML element that will wrap the chart.

string Value for the chart id. If not provided, one will be generated automatically. Although, it's helpful to specify your own so you can use to track charts when there several.


array The array of CSS class names that you want to add to your chart. This should be used if you're planning on using your own styles for the charts.


number Sets the height of the chart.


number Sets the width of the chart.


object Sets the margins of the chart. The margin property must have the properties top, right, bottom, and left. Example:

  "margin": {"top": 10, "right": 20, "bottom": 30, "left": 30}

array This is usually an array of objects. For example:

    {"x": "Mon", "y": 1},
    {"x": "Tue", "y": 2}

If you use properties other than "x" and "y", then you must set the accessor properties - accessorX and accessorY.


function | string Use this property to set the accessor function or string value for the x values in the data.


function | string Use this property to set the accessor function or string valuer for the y values in the data.

Use the accessor properties if the entries fields in data are other than "x" and "y".


Use this property to explicitly set the domain of the x scale.


Use this property to explicity set the domain of the y scale.


boolean Use false if you don't what the chart to draw circles that represent data points. Default is true.


boolean Use false if you don't want the chart to show the guide lines that go across the length and width of the chart. Default is true.


ThreesyLine supports the use of Tether Tooltip. To use this feature, first, include the tooltip dependencies. The tooltip is bound to the datapoint <circle> elements of the chart, so it needs to be visible. FYI, the default behavior is to show the data-points.

Include Tether dependencies:

<link rel="stylesheet" href="css/tooltip-theme-arrows.css" />
<script src="tether.min.js"></script>
<script src="drop.min.js"></script>
<script src="tooltip.min.js"></script>

Programmatically enable the tooltip. The <circle> data-points elements need to be visible first, so it is important to invoke the chart instance's draw() before enabling the tooltip.

var chart = new ThreesyLine({...});

// Must call draw before enabling the tooltip.

// The "data-tooltip" and "data-tooltip-position" attributes
// belong to Tether tooltip.
  .attr("data-tooltip", function(d) {
    // E.g. "Monday: 32.4"
    return d.x + ": " + d.y;
  .attr("data-tooltip-position", "top center");

You can learn more about using the Tether tooltip by reading their documentation.