GithubHelp home page GithubHelp logo

flot-legend's Introduction

flot-legend Build Status

rrdgraph style legend support for Flot

About

flot-legend can be used to render customizable legends to the chart canvas using syntax similar to rrdgraph's GPRINT.

AREA:float1#babdb6:"1  minute" \
GPRINT:float1:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:float1:MIN:"Min \\: %10.2lf" \
GPRINT:float1:MAX:"Max \\: %10.2lf\\n" \
AREA:float5#888a85:"5  minute" \
GPRINT:float5:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:float5:MIN:"Min \\: %10.2lf" \
GPRINT:float5:MAX:"Max \\: %10.2lf\\n" \
LINE2:float15#a40000:"15 minute" \
GPRINT:float15:AVERAGE:"Avg \\: %10.2lf" \
GPRINT:float15:MIN:"Min \\: %10.2lf" \
GPRINT:float15:MAX:"Max \\: %10.2lf\\n" \
VDEF:sum=other,TOTAL \
GPRINT:sum:"Total \\: %10.2lf\\n"

If the aggregation property is not defined, the value used for a legend statement can be provided directly from the statement.

Configuration

var series = [
    {
        metric: 'main',
        color: '#feeded',
        data: [[0,0,0], [0,0,0], ...]
    }
];

var hiddenSeries = [
    {
        metric: 'other',
        data: [[0,0,0], [0,0,0], ...]
    }
];

var options = {
    legend: {
        statements: [
            {
                metric: 'main',
                format: '%g nominal Watts'
            },
            {
                metric: 'main',
                aggregation: 'AVERAGE',
                format: 'Avg: %8.2lf %s'
            },
            {
                metric: 'main',
                aggregation: 'MIN',
                format: 'Min: %8.2lf %s'
            },
            {
                metric: 'main',
                aggregation: 'MAX',
                format: 'Max: %8.2lf %s\n'
            },
            {
                metric: 'other',
                value: 42.0,
                format: 'Other - Avg: %8.2lf %s\n'
            },
        ]
    },
    hiddenSeries: hiddenSeries
};

$.plot('#placeholder', series, options);

flot-legend's People

Contributors

fooker avatar

Watchers

James Cloos 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.