simpledimple

1.1.1 • Public • Published

npm tests license

Simpledimple.js

Simpledimple.js is an opensource lightweight JavaScript wrapper and extension API for dimple. Simpledimple.js is originally written by Nagarajan Chinnasamy at Mindtree.

dimple is a simply powerful object-oriented API for business analytics powered by D3.js.

What does it do?

Simpledimple.js

* Separates the configuration of properties of charts from JavaScript code
* Facilitates externalization of the parameters of a chart thus opening the possibilities of:
    * Interactive tools based designing of charts
    * External storage and
    * Exchange of charts
* Extends dimple library to make externalized chart configuration more self contained    

This wrapper API accepts the entire configuration of a chart (E.g., parameters of axis, series etc.) as a single JavaScript object and internally handles the calls to be made to dimple. Following is an example chart configuration:

var chartConfig = {
    bounds: {
        x: 70,
        y: 30,
        width: 505,
        height: 305
    },
    axes: [{
        position: "x",
        categoryFields: "Month",
        orderRules: [{ ordering: "Date" }]
    }, {
        position: "y",
        measure: "Unit Sales"
    }],
    series: [{
        plot: "area",
        interpolation: "step",
        lineWeight: 1
    }]
};

To create a chart, you use new simpledimple.chart passing the chart configuration and data. Then, invoke draw() function on the newly created chart object to draw the chart:

var svg = dimple.newSvg("#chartContainer", 590, 400);
var myChart = new simpledimple.chart(svg, chartConfig, data);
myChart.draw();

Documentation?

Please refer to the Wiki for documentation.

How do I load the code?

Simpledimple.js implements the Universal Module Definition (UMD) pattern and so should be compatible with most approaches to script loading and dependency management: direct script loading with RequireJS, Browserify etc. For these options, you can grab it from NPM with npm install simpledimple or via Bower with bower install simpledimple.

If you are loading the scripts directly (as in the examples), you need to:

  1. Load the dependencies:
  2. d3 - <script src="https://d3js.org/d3.v3.min.js"></script>
  3. dimple - <script src="http://dimplejs.org/dist/dimple.v2.2.0.min.js"></script>
  4. Load the simpledimple.js files:
  5. simpledimple.min.js

Here is the source code of an exmaple

Where can I see the demo?

You can see the live demo at examples page.

Is there an online tool to experiment and design my own charts?

Yes. You can use the fiddle tool to:

* Load sample or your own data
* Browse and load sample chart configuration and edit
* Verify and create your own charts

How can I build the code and run the tests?

Install grunt and bower using:

npm install -g grunt
npm install -g bower

To install the development dependencies, just run:

npm install
bower install

which will create node_modules and bower_components folders with the files required to run the Grunt build system.

After modifying any of the .js files at the top of the repo, you can compile/minify the files into the dist directory by running

grunt

This also starts a webserver bound to port 3001 that can be used to browse simpledimple home page that has links to examples and fiddle application. Browse the URL: http://localhost:3001/

To run the tests, use:

grunt test

How can I contribute?

Pull requests are welcome! Here are some Contribution Guidelines.

I have a question, how can I get in touch?

Please first check the issues that are already raised and if you can't find what you're looking for there, then please create a GitHub Issue. When creating an issue, please try to provide a replicable test case so that others can more easily help you.

Copyright & Licence (MIT License)

Simpledimple.js is © 2016 Nagarajan Chinnasamy, Mindtree, other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i simpledimple

Weekly Downloads

1

Version

1.1.1

License

MIT

Last publish

Collaborators

  • nagarajanchinnasamy