Git Product home page Git Product logo

easychart's Introduction

Easychart

A visual editor for the world's best web charting tool: [Highcharts] (http://www.highcharts.com/)

WHAT IS EASYCHART?

Easychart is a graphical user interface, built on top of the stunning Highcharts-javascript library.

Csv data parsing/structure.

In order to parse your submitted data correctly it is important to know that:

  • columns contain series, the first cell of a column contains the series-name
  • when using categories, the first column contains the category-names (the first cell of the category-column MUST BE EMPTY)

Easychart integration

Highcharts

Easychart is written as a vannila js application, very easy to integrate in your specific project or content management system. In fact, the Easychart-plugin isn't really made for standalone-use, it is made to shine in the backend of content management systems.

We've already built an [Easychart-module for Drupal] (https://www.drupal.org/project/easychart) which blends seamlessly with our Easychart-plugin. This module makes it possible to manage your charts in a convenient Drupal-manner. Even more, a chart only needs to be made once and can be reused in other nodes, views, panels... Not enough? It even has WYSIWYG-integration so it's possible to add charts through your texteditor.

The Easychart-plugin and -Drupal-module are free.

Attention [Highcharts] (http://www.highcharts.com/) is free for personal, school or non-profit projects under the Creative Commons Attribution - Non Commercial 3.0 License. For commercial and governmental websites and projects, you need to buy a license. (But they're absolutely worth every penny.) See [License and Pricing] (http://shop.highsoft.com/highcharts.html).

With Easychart we hope to make the beauty of Highcharts accessible to almost everyone. The people at [Highsoft] (http://www.highcharts.com/about) are (y)our true heroes, credit where credit is due.

Handsontable

If [Handsontable] (https://handsontable.com/) is loaded before Easychart, it will use it automatically as data editor. Otherwise it will fallback to a simple editable table.

options

You can pass on a options object to the easychart intialiser. The initialiser is best wrapped in a DOMContentLoaded wrapper.

document.addEventListener("DOMContentLoaded", function () {
    var options = {};
    new ec(options);
})

options.element

var containerNode = document.getElementById('container');
new ec({
    element: containerNode
});

options.templatesTab

Toggles the templates tab [default:true]

new ec({
    templatesTab: true
});

options.dataTab

Toggles the data tab [default:true]

new ec({
    dataTab: true
});

options.customiseTab

Toggles the customise tab [default:true]

new ec({
    customiseTab: true
});

options.chartTab

Toggles the chart tab [default:false]

new ec({
    chartTab: true
});

options.debuggerTab

Toggles the debugger tab [default:false]

new ec({
    debuggerTab: true
});

options.data

Pass an array with data.

var data = [
    [0,1,3],
    [1,5,7]
]
new ec({
    data: data
});

options.dataCSV

Pass a csv string with data.

var csvString = '1,2,3'
new ec({
    dataCSV: csvString
});

options.dataUrl

Pass an url to a csv file with data

new ec({
    dataUrl:'//dummyurl.com/dummy.csv'
});

options.options

Pass an options object with the customisable attributes for the customise page

var opts:[
    {
        "id": "chart",
        "panelTitle": "Chart settings",
        "panes": [
            {
                "title": "Chart type and interaction",
                "options": [
                    {
                        "name": "chart--type",
                        "fullname": "chart.type",
                        "title": "type",
                        "parent": "chart",
                        "isParent": false,
                        "returnType": "String",
                        "defaults": "line",
                        "values": "[\"line\", \"spline\", \"column\", \"bar\", \"area\", \"areaspline\", \"pie\", \"arearange\", \"areasplinerange\", \"boxplot\", \"bubble\", \"columnrange\", \"errorbar\", \"funnel\", \"gauge\", \"heatmap\", \"polygon\", \"pyramid\", \"scatter\", \"solidgauge\", \"treemap\", \"waterfall\"]",
                        "since": "2.1.0",
                        "description": "The default series type for the chart. Can be any of the chart types listed under <a href=\"#plotOptions\">plotOptions</a>.",
                        "demo": "<a href=\"http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/chart/type-bar/\" target=\"_blank\">Bar</a>",
                        "deprecated": false
                    }
                ]
            }
        ]
    }
];

new ec({
    options: opts
});

example options disclaimer this file is generated -> link

options.optionsUrl

Pass an url to a options json file

new ec({
    optionsUrl: 'examplepathto/options.json'
});

options.templates

Pass a array with preconfigured templates for the template page.

var templatesArray = [
    {
        "id": "line",
        "type": "Line charts",
        "icon": "line",
        "templates": [
            {
                "id": "basic",
                "icon": "line_basic",
                "title": "Line chart",
                "desc": "Requires one column for X values or categories, subsequently one column for each series' Y values.",
                "definition": {
                    "chart": {
                        "type": "line"
                    },
                    "xAxis": [{
                        "type": "category"
                    }]
                }
            }
        ]
    }
];

new ec({
    templates:templatesObject
});

example templates

options.config

Load a existing config object

new ec({
    data:[['move', 'excersise', 'stand'], [80,65,50]],
    config:{
           "chart": {
               "type": "column",
               "inverted": true,
               "animation": false
           },
           "xAxis": [
               {
                   "type": "category"
               }
           ],
           "plotOptions": {
               "series": {
                   "dataLabels": {
                       "enabled": true
                   }
               }
           }
    }
});

options.presets

Load presets options, a preset has the same structure as options but cannot be overwritten by the user or other config. Is a tool for setting site wide config. e.g. colors

new ec({
    presets:{
       "colors": [
            "#ECFF7C",
            "#000000",
            "#FF0000"
        ]
    }
});

options.showLogo

Toggle on and off the logo [default:true]

new ec({
    showLogo: false
});

api

instance.setData

Set the current data object.

var instance = new ec();
var data = [
    [0,1,3],
    [1,5,7]
]
instance.setData(data);

instance.getData

Get the current data object.

var instance = new ec();

instance.getData();

instance.setDataUrl

Set a data url to a csv file

var instance = new ec();
instance.setDataUrl('pathtocsvfile/file.csv')

instance.getDataUrl

Get current data url

var instance = new ec();
instance.getDataUrl();

instance.setDataCSV

Set a csv string with data.

var csvString = '1,2,3'
var instance = new ec();
instance.setDataCSV(csvString);

instance.setOptions

Set the options with the customisable attributes for the customise page

var opts = [
    {
        "id": "chart",
        "panelTitle": "Chart settings",
        "panes": [
            {
                "title": "Chart type and interaction",
                "options": [
                    {
                        "name": "chart--type",
                        "fullname": "chart.type",
                        "title": "type",
                        "parent": "chart",
                        "isParent": false,
                        "returnType": "String",
                        "defaults": "line",
                        "values": "[\"line\", \"spline\", \"column\", \"bar\", \"area\", \"areaspline\", \"pie\", \"arearange\", \"areasplinerange\", \"boxplot\", \"bubble\", \"columnrange\", \"errorbar\", \"funnel\", \"gauge\", \"heatmap\", \"polygon\", \"pyramid\", \"scatter\", \"solidgauge\", \"treemap\", \"waterfall\"]",
                        "since": "2.1.0",
                        "description": "The default series type for the chart. Can be any of the chart types listed under <a href=\"#plotOptions\">plotOptions</a>.",
                        "demo": "<a href=\"http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/chart/type-bar/\" target=\"_blank\">Bar</a>",
                        "deprecated": false
                    }
                ]
            }
        ]
    }
];
var instance = new ec();
instance.setOptions(opts)

instance.getOptions

Get the current options config.

var instance = new ec();
instance.getOptions()

instance.setTemplates

Set an array with preconfigured templates for the template page.

var templatesArray = [
    {
        "id": "line",
        "type": "Line charts",
        "icon": "line",
        "templates": [
            {
                "id": "basic",
                "icon": "line_basic",
                "title": "Line chart",
                "desc": "Requires one column for X values or categories, subsequently one column for each series' Y values.",
                "definition": {
                    "chart": {
                        "type": "line"
                    },
                    "xAxis": [{
                        "type": "category"
                    }]
                }
            }
        ]
    }
];
var instance = new ec();
instance.setTemplates(templatesArray);

instance.getTemplates

Get the current template list.

var instance = new ec();
instance.getTemplates();

instance.setConfig

Set the current config from code

var instance = new ec();
var config =
    {
        "chart": {
            "type": "column",
            "inverted": true,
            "animation": false
        },
        "xAxis": [
            {
                "type": "category"
            }
        ],
        "plotOptions": {
            "series": {
                "dataLabels": {
                    "enabled": true
                }
            }
        }
    };
instance.setConfig(config);

instance.getConfig

Get the current config.

var instance = new ec();
instance.getConfig()

instance.setOptionsUrl

var instance = new ec();
instance.setOptionsUrl('urltojsonfile.json')

instance.getOptionsUrl

Get the current options url.

var instance = new ec();
instance.getOptionsUrl()

instance.setPresets

set the presets for the instance

 var presets = {
       "colors": [
            "#ECFF7C",
            "#000000",
            "#FF0000"
        ]
    }

var instance = new ec();
instance.setPreset(preset)

instance.getPresets

Get the current presets.

var instance = new ec();
instance.getPresets()

Setup

// install dependencies
npm install
// watch and build app
gulp watchify:app
// watch and build render app
gulp watchify:render
// production build the app
gulp build

Generate options file

The project also contains a small nodejs script that merges the customise with the definitions from the highcharts attributes dump file.

To run the generator:

// install dependencies
npm install
// run generator
npm run genOptions

Builds

App

App build is used when configuring a chart and is best used in a backend/logged in usecase, since it quite large and has loos dependencies like highlightjs and handsontables.

Render

Render build is used for converting raw data and configuration to an highcharts graph, this build is best used for displaying graphs build by easychart. The render build only has a limited set op options and api calls.

options:

  • data
  • dataUrl
  • config
  • presets
  • element

api:

  • setData
  • setDataUrl
  • setConfig
  • setPresets

License

Available under the MIT license.

Sponsoring

This plugin was initially developed for and partially sponsored by The Government of Flanders: http://overheid.vlaanderen.be.

easychart's People

Contributors

daemth avatar frankbaele avatar jyve avatar llanzo avatar sgologuzov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easychart's Issues

Saving config used on a view chart

Hi.

I have the config now saving to a database. the example string is
"{"chart":{"type":"area"},"xAxis":[{"type":"category"}],"yAxis":[{}],"plotOptions":{"series":{"dataLabels":{"enabled":true},"marker":{"enabled":false}}},"title":{"text":"sdfsdfsd"}}"

When I then use this script it doesn't show the title for example or change it to an area graph.

<!!!!!!!!!script>

var cd ;

document.addEventListener("DOMContentLoaded", function () {

    var configdata = @Html.Raw(@configedchart);


    var chart = new ec({
        element     : document.getElementById('container'),
        dataUrl     : '/chart/[email protected]&[email protected]',
       config      : configdata,
        dataTab     : false,
        templatesTab: false,
        customiseTab: false,
        UIMode: 'viewer'

    });
    cd = configdata;
    chart.setConfig(configdata);

});

<!!!!!!!!!/script>

Any suggestions? Thanks

Use Vue.js

Use vue.js for routing,templating, rendering and structuring the app instead of custom implementations.

error when setting options and clicking 'Axes'

When I set the options and then click on 'Axes' in the Customize set, I get an error:

Uncaught TypeError: Cannot read property 'options' of undefined

As long as I don't set options myself, everything works ok.

yAxis type should not be copied/extended from xAxis

If your xAxis' type is "category" and your yAxis has high values, highcharts produces the error "Uncaught Highcharts error #19: www.highcharts.com/errors/19". It's about there being too many ticks, that simply can not be shown on the chart's canvas.

This is because the yAxis values are being extended with the xAxis values at line 512 in jquery.easychart.js, as is defined at line 10028 in highchartsConfigurationOptions.js. I noticed highchartsConfigurationOptions.js also provides a excluding option for each entry, but this seems to be ignored when extending. A quick fix I used for bestuurszaken.be is to not let the yAxis extend the xAxis, but if the excluding option would be taken into account, then I presume it would be better to set the excluding parameter for the yAxis to "type" so the type is not being copied over.

How to...

Hi there.

I have the below data.

I want to show the graph grouped on the date, with on that day there was high medium and low numbers.

Please can you advise how I can do this please?

Thanks in advance.

    , Count  Date
 High    16  2016-10-03
 Medium  14  2016-10-03
 Low     20  2016-10-03
 High    19  2016-10-04
 Medium  17  2016-10-04
 Low     12  2016-10-04
 High    22  2016-10-05
 Medium  15  2016-10-05
 Low     20  2016-10-05
 High    20  2016-10-06
 Medium  12  2016-10-06
 Low     14  2016-10-06
 High    9   2016-10-07
 Medium  16  2016-10-07
 Low     21  2016-10-07
 High    21  2016-10-10
 Medium  15  2016-10-10
 Low     25  2016-10-10

Is it possible to refresh the preview in the editor?

Hi,
I am setting my data and config from outside via ec.setConfig(config) and ec.setData(config). Then when I am opening my bootstrap modal window where the easychart editor is included, the data and config is set correct, but the highcharts preview box on the right (<div id="chartContainer">...</div>) was not being updated.

Can I call a function to force an update on it?

Thank you!
Michael

Datetime

Hi what format should the date time be in.

and how can I format it for example MM-DD-YYYY or DD-MMM-YY

thanks

Jon

how to get the config with the data included?

when I see the demo and the debug tab, I have the full config string with the data included here. But as soon as I do easyChartInstance.getConfig(); I have the config object without the data within the series attribute.

How can I get the exact same javascript object as shown in the debug tab?

make use of new Highcharts 5.0.0 methods

from Highcharts changelog:

Highcharts 5.0.0 (2016-09-29):

  • Added styled mode for optional separation of SVG and CSS.
  • Added responsive option set.
  • Added accessibility option set.
  • Added new function, Chart.update in order to update the chart options after render time.
  • Added new function, Chart.addCredits.
  • Added new function, Chart.title.update.
  • Added new function, Chart.credits.update.
  • Added new function, Legend.update.
  • ...

EC standalone plug-in - various improvements / feature requests

Hi @daemth , I'm Alexandre, and we'll meet on October 10th, nice to meet you ;-) .

First of all, I'd like to congratulate you for this great project which really makes the configuration and integration of charts an easy process.

I'd like to share with you and the community a list of improvements that could be added to EC. Most of them will serve some of our specific needs, but they might also interest other people. Here there are.

Generic businesses

Support of live / on-the-fly data (CSV)

At the moment, EC provides the tab "url CSV" to reference a CSV file, but as soon as the form is submitted, the CSV file is imported. So live data is then turned into static data, embed in the HC JSON object.

Possible improvement: link to the URL of the CSV file containing data, and grab the data on-the-fly, at the time the chart is rendered.

It might not have to be tackled at EC level, but some mechanisms will have to make such behavior efficient (caching, etc.).

Support of live / on-the-fly data (JSON)

Similar to previous case, except it would support data configured in a JSON file.

Possible improvement: link to the URL of the JSON file containing data, and grab the data on-the-fly, at the time the chart is rendered.

Support of JSON import / copy-paste / URL

When EC is used together with DP, the HC JSON object is saved and can be retrieved / edited at later time.

With the EC standalone plug-in, such feature is missing so webmasters have no mean to edit an existing chart at a later time.

Possible improvement: allow the import / copy-paste / link to URL of HC JSON object to resume or allow editing of existing charts.

Similar request: #14

Load / Save

This is similar to previous case, except it would allow to save / load charts directly from the EC standalone plug-in.

Sounds like something in progress: #22

Support of themes

There is no option to load additional themes provided by HC (https://github.com/highcharts/highcharts/tree/master/js/themes) - Examples:

Possible improvement: add a tab or an option to select a different theme.

Pluggable EC

The ReadMe file hosted on EC Github https://github.com/daemth/easychart provides well document API and ways to configure the EC object.

Anyway, there's no information on how to plug or hook elements to the EC GUI or engine.

Possible improvement: provide technical documentation on how to create plug-ins / enrich features of EC.

Specific businesses

These businesses are not all directly related to EC, as EC is a GUI for HC and is limited to HC possibilities.

However, they are mentioned to give a large vision on how charts can be used within organizations.

Support of JSON-stat

Possible improvement: reference a JSON-stat URL as a source of data (more information about JSON-stat format https://json-stat.org/ ).

But for this, JSON-stat should be supported by HC first.

Wrapping of HC JSON object into an abstract object

EC allows to create a HC JSON object to represent a chart.

In our project, the HC JSON object must then be wrapped into a abstract object so that it can be detected and rendered by our custom lazy loader.

Possible improvement: provide a way to wrap the HC JSON object or map properties into an abstract object.

add UIMode-option

Right now the type of build depends on the script you're using; app vs render.
An option to choose the "UI-mode" (eg preview vs editor) would be nicer:

var easychart = new ec({
                element: document.getElementById("easychart-container"),
                UIMode: 'render',
                dataUrl:'data/line.csv'
            });

Using an Easychart Field with the Paragraphs module

Hello,

Not sure if this issue should be posted here or not, tried the drupal.org project issue queue and didn't hear anything back.

The site I'm developing needs to have multiple chart types per node so I decided to use the Paragraphs module so I could mix and match with other fields (ie. tablefield). I set up a paragraph bundle with a chart field in it and when I viewed the node edit form the chart field displayed twice inside the paragraph (see screen grab attached). I tried adding a chart field to a field collection and the same thing happened.

If there's anyway you could help me out with this it would be greatly appreciated. Please let me know if any other info is needed.

easychart_paragraphs

buttons should have the type 'button'

All buttons within the Easychart plugin should have the type 'button' to avoid that they submit a form e.g. when they are included in the Drupal node edit form.

chart.events object is always empty

in the 'appleWatch' template, there are some functions in the chart.events object. However in the config returned by the configUpdate event, the chart.events object is always empty.

Questions / Support

Hi,

Firstly what a great product!

Im very keen to use this in some software I'm in the middle of build. at present Im building the charts manually and thats long winded.

The aim is to use your EasyChart to allow users to modify the chart with ease.

so have some question.

How can I show a chart that users EasyChart to pull the data from a URL and then show it to the page?

How can I save what the user has modified?

Im lost really within the documentation, not sure where to start.

An example would be awesome. Ideal would be to have a chart on a page with a spanner symbol then click that, this will load the EasyChart JS page. ("easyChart/demo/index.html") then make the change, hit save and its then rendered on the page for all users to see.

PlotBands require whole numbers

When working with Column charts and trying to set a plot-band, you can set it to a decimal number (e.g. 1.5) and it previews fine, but it won't let you save. You get a "Please enter a valid value. The two nearest valid values are 1 and 2."

Data loss with gauge chart

When selecting a polar chart (apple watch), the chart looks ok. However the configuration sent through an api call looses some information:

Original version taken from the debug panel:
...
"series": [
{
"borderColor": "#7cb5ec",
"data": [
{
"color": "#7cb5ec",
"radius": "100%",
"innerRadius": "100%",
"y": 80
}
],
"animation": false,
"name": "Move"
},

...

Version received after API call:

"series": [
{
"borderColor": "#7cb5ec",
"animation": false,
"name": "Move",
"data": [
{
"y": 80
}
]
},

Separation of source types

Hey,
some wouldn't say it's an issue but it definitely is: It's easy to see your love to nodejs and javascript but it's an design issue to combine everything in javascript to finally spit it out.
A more welcome separation would at least consider separate css and not a single but bloated javascript file that includes markup, styling and scripting.

I know it's working but it's absolutely unnecessary, makes it harder to customize and does not follow any guideline for separation of different contents. Only because it's possible it doesn't mean that it's a good way.

Please consider in the future a better concept that separates javascript, css and maybe a html-template for the html markup that will be used by your nodejs scripts. It would help to widespread your very cool tool and to gain acceptance.

Best regards

Setting high of chart

Hi is there a way of doing this?

Ive got multiple charts on a page, some have to be bigger that others etc

Application building is broken

When I try to build the app, I have the error:

[23:22:14] Using gulpfile ~/work/github/easychart/gulpfile.js
[23:22:14] Starting 'watchify:app'...
[23:22:16] Browserify Error { [Error: Cannot find module 'lodash.keys' from '/home/gologuzov/work/github/easychart/src/js/services']

problem with default array values in guiConfig-object (reported by @ataimist)

When an array is entered as default value for an option (e.g. "colors") in the guiConfig-object it gets parsed wrong and results in an error.

Normally, defaults can be set as followed:

var guiConfig = {
  "panels": [
    //...
    {
      "panelTitle": "Colors and borders",
      "panes"     : [
        {
          "title"  : "default colors",
          "options":[{"name":"colors","defaults":["#ff00ff" , "#434348" , "#90ed7d" , "#f7a35c" , "#8085e9" , "#f15c80" , "#e4d354" , "#2b908f" , "#f45b5b" , "#91e8e1"]}]
        }
        // more panes here...
      ]
    }

    // more panels here...

  ]
};

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.