Giter Site home page Giter Site logo

jquery-treemap's Introduction

JQuery Tree Map

A simple jQuery plugin to create a tree map view of json data.

How to use

  1. Import the script. Then your jQuery objects will have a new function.

    $('div#someId').treemap([]);
  2. The json should have the follow format.

    $('div#someId').treemap(
    [
        {
        label: 'Label of treemap node',
        value: 100, // A number that defines the size of the node into the tree map.
        data: 'some arbitrary data. Can be a string'
        },
        {...} // This is a list
    ]);

  1. Customizing the looking and feel.

You can pass a second parameter containing some options to customize the looking and feel of the tree map.

$('div#someId).treemap(
    [],
    {
        backgroundColor: function(node){
            //node is an item of the list passed as the first arg of this fuction;
            return 'red'; // You should return a css valid color string.
        },
        color: function(node){
            //node is an item of the list passed as the first arg of this fuction;
            return 'red'; // You should return a css valid color string.
        },
        nodeClass: function(node){
            //node is an item of the list passed as the first arg of this fuction;
            return 'my-class'; // You should return your customized css class here.
        }
    }
);
  1. Customizing the events

You can alsa pass functions to deal with events related to mouse.

$('div#someId).treemap(
    [],
    {
        click: function(node, event){
            // click on a node
        },
        mouseenter: function(node, event){
            // mouse enter a node
        },
        mouseleave: function(node){
            //mouse leaves a node
        }
    }
);

jquery-treemap's People

Contributors

lrgalego avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.