Giter Site home page Giter Site logo

a6b8 / statosio-for-javascript Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 0.0 304 KB

statosio.js is an add-on function for d3 to generate simple charts, in a fast and reliable way.

Home Page: https://docs.statosio.com

License: MIT License

JavaScript 5.16% JavaScript 14.01% HTML 80.84%
d3 d3js statosio statosiojs javascript svg bar-chart point-chart bar-stacked-chart

statosio-for-javascript's Introduction

Statosio for Javascript

Statosio is an add-on function for d3 to generate simple charts, in a fast and reliable way.


Examples

Select

# d3.statosio
Select and change position of columns

Sort Data

# d3.statosio
Sort dataset by values

Change Style

# d3.statosio
Change style to dark-mode


Table of Contents
  1. Examples
  2. Quickstart
  3. Video Introduction
  4. Documentation
  5. Chart Types
  6. Parameters
  7. Options
  8. Contributing
  9. License
  10. Code of Conduct
  11. Support my Work

Quickstart
<!DOCTYPE html>
<head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/6.2.0/d3.js"></script>
    <script src="../libs/statosio.js"></script>
</head>
<body>
    <script>
        d3.json( "../data/performance.json" )
            .then( ( file ) => {
                d3.statosio( 
                    file, 
                    "name", 
                    [ "mobile" ], 
                    { 
                        "showAverage" : false,
                    }
                )
            } 
        )
    </script>
</body>

Setup
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/6.2.0/d3.js">
</script>

Video Introduction

https://www.youtube.com/watch?v=i6od9O8jz1E


Documentation

https://docs.statosio.com


Chart Types

✔️ build simple diagrams fast and reliable, with one function!

✔️ pure javascript, no additonal css.

✔️ highly customizable with 40+ style and data options.

Bar

# d3.statosio
Create simple bar chart

Point

# d3.statosio
Create a simple point chart

Stacked

# d3.statosio
Create simple stacked bar chart


Parameters

Source:

  <script src="https://cdnjs.cloudflare.com/ajax/libs/statosio/0.9/statosio.js"></script>
d3.statosio( dataset, x, y, options )
Value Type
dataset [{},{}...] Array of Objects
x "name" String
y "mobile", [ "mobile",... ] String or Array of Strings
options {} Object

Options

https://docs.statosio.com/options/

Option Default Examples Description 
A.1. showTitle false A, B Show or hide title on the front of the diagram.
A.2. showLegend false A, B, C Show or hide legend. Recommended for stacked diagrams.
A.3. showAverage true A, B, C Calculate and show average line
A.4. showRangeYLog false A, B Calculate and show range y in a log scale.
A.5. showDataAsCircle false A, B, C Show data as circles instead of rectangles. Only for not stacked diagram available.
B.1. viewTitle "Statosio Demo" A Set title content.
B.2. viewDomId "d3_statosio" A Set id from the
Element which holds the d3 content inside.
B.3. viewMarginTop 20 A, B Set margin top
B.4. viewMarginRight 40 A, B Set margin right
B.5. viewMarginBottom 100 A, B Set margin bottom
B.6. viewMarginLeft 60 A, B Set margin left
B.7. viewWidthOuter 600 A, B Set width of the "canvas" including margin, titles etc.
B.8. viewHeightOuter 300 A, B Set height of the "canvas" including margin.
B.9. viewTranslateMultiplicator 1.5 A, B Between title, legend and diagram are spaces. These spaces gets calculated through this multiplicator.
C.1. dataXKey "" Expect a "key" name from the dataset to arrange the x range.
C.2. dataXSelectors [] A, B Expect one or more names which are included in the x range.
C.3. dataXTextLength 25 A, B This value counts the length of the x range names an cut of the rest.
C.4. dataXTextPlaceholder "..." A, B Set an suffix behind a string. As a signal to the viewer, that the text was cut of.
C.5. dataYKeys [] Expect "keys" from the dataset to arrange the y range. If you use one key the internal state is "bar". if you use multiple the internal is "stacked"
C.6. dataYTicks 5 A, B Ticks in d3 land means "steps". Here you can set the steps from the grid and y range.
C.7. dataSortCurrent "none" A, B Set the general route for sorting. You can choose between "none", "values", "names".
C.8. dataSortByValues "decending" A, B, C Here you can set type of sorting. You can choose between "ascending" and "decending"
C.9. dataSortByNames "ascending" A, B Here you can set type of sorting. You can choose between "ascending" and "decending"
C.10. dataSortSelection "none" A, B, C Change position of your selection. You can choose between "start", "end" and "none"
C.11. dataLegendTextSeparater "_" A This tweak split your keys with the separater and capitalize every word and insert a space in between.
D.1. styleColorAverage "#000000" A, B Set color of the average line.
D.2. styleColorCanvasBackground "white" A, B Set background color.
D.3. styleColorFont "#000000" A, B Set default font color. Excluding non-selection content.
D.4. styleColorLegends ["#5186EC", "#D95040", "#F2BD42"] A, B Set legend color palettes. Expect an array of "hex" values or "html" color-names.
D.5. styleColorGridline "#E5E5E5" A, B Set the gridline color. Use "hex" value or "html" color-names.
D.6. styleColorSelectorsChart ["#EE752F", "#5186EC"] A, B Colorize the chart of the selection. Use "hex" values or "html" color-names.
D.7. styleColorSelectorsText ["#000000", "#000000"] A, B Colorize the font of the selection. Use "hex" values or "html" color-names.
D.8. styleFontSizeText 10 A, B Set default font size, including selection.
D.9. styleFontSizeTitle 18 A, B Set font size of title
D.10. styleFontFamily "arial" A, B Set default font family
D.11. styleFontFormatSelectors ["bold", "normal"] A, B Set format of content use "Html" Syntax ("bold", "underline", "normal" etc.).
D.12. styleStrokeAverage 2 A, B Set stroke weight of average line.
D.13. styleStrokeGridline 2 A, B Set stroke weight of gridline.
D.14. styleLegendRectSizeFull 16 A, B Set rectangle size of legend item.
D.15. styleOtherCircleChartRadius 4 A, B Set radius of circle.
D.16. styleOtherRangeXTextRotation -45 A, B Set text rotation of the x axis.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/a6b8/statosio-for-wordpress. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.


Limitations
Credits
License

The gem is available as open source under the terms of the MIT License.


Code of Conduct

Everyone interacting in the Statosio project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.


Star us

Please ⭐️ star this Project, every ⭐️ star makes us very happy!

statosio-for-javascript's People

Contributors

a6b8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.