Code Monkey home page Code Monkey logo

justcharts's Introduction

justcharts

Just charts. Really.

The goal of this project is to make it incredibly easy to hack together a vegalite dashboard declaratively. The goal is that anything made in the vegalite editor can be copied into a static file with ease.

include

You can use jsDelivr to deliver the justcharts.js file via CDN. Note that you'll also need to have some vega dependencies around.

<script src="https://cdn.jsdelivr.net/npm/vega@5"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@5"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@6"></script>
<script src="https://cdn.jsdelivr.net/gh/koaning/justcharts/justcharts.js"></script>

usage

There are two main ways you can create just charts.

schema

You can create a vega based chart directly in html.

<vegachart schema-url="schemaone.json"></vegachart>

inline

Alternatively, you can also declare the vegalite-json definition inline in the vegachart component.

<vegachart style="width: 100%">
    {
        "data":{
            "url": "https://cdn.jsdelivr.net/gh/koaning/justcharts/bigmac.csv",
            "format": {
                "type": "csv"
            }
        },
        "mark": "line",
        "encoding": {
            "x": {"field": "date", "type": "temporal"},
            "y": {"field": "local_price", "type": "quantitative"},
            "color": {"field": "currency_code", "type": "nominal"}
        },
        "width": "container",
        "title": "hello there"
    }
</vegachart>

Note the "width":"container" setting. By doing this you're able to set the width/height of the chart directly from the <vegachart> html-style property. This is great for containers with relative widths.

demo

You can find a demo here.

justcharts's People

Contributors

ericmjl avatar koaning 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.