ACE Labs feature: this element is under development and the API is not bound by SemVer. Watch the changelog!
2017.09.21: due to low adoption and demand this component is not currently prioritised for further development.

Design

Colour Palette

Requirments

To be user friendly, the ACE charts colour palette has the following requirements:

  1. A colour set large enough to accomodate multiple data series
  2. It must be easy to differentiate between the colours, including the following:
    • Easy to differentiate when printed in greyscale
    • Easier to differentiate for colour blindness
    • Distinct from the main ACE colour palette.
      It needs to stand out from the page structure and avoid confusion with the semantics of ACE colours, p.ace-particularly from the success and error semantics.
Colour palette theory

The colour palette chosen is based on the cubehelix colour system.
This system accomodates for the different perception of colours in human vision compared to common computed colour scales, p.ace-particularly in percieving the weight of colour saturation and brightness. It is designed to be monotonically increasing in terms of its perceived brightness. In this way, cubhelix contrasts the interpolation methods of RGB, HSL and HCL which do not accomodate specfically for greyscale printing or vision impairment.

Cubehelix has the following unique features:

Colours

The spefic palette chosen accomodates up to twelve data series. (see cubehelix3_16)

  1. #00443C
  2. #005083
  3. #034BCA
  4. #483CFC
  5. #9C2BFF
  6. #EB24F4
  7. #FF2DC2
  8. #FF4986
  9. #FF7356
  10. #FFA443
  11. #EBD155
  12. #D3F187
Palette use in charting
Linear

Charts showing a graduating change in values should display the colours in the linear order.

This can be approiate when representing distribution data such as with a column or line histogram, scatter chart, or gauge.

Sequenced

Most chart types best represent data with colours in a non-linear sequence.

This maximises our ability to visually differentiate between each data series.

The sequenced colour palette can be appropiate when representing composition data such as with a pie or stacked column chart; when representing relationship data such as with a scatter or bubble chart; and when representing comparison data such as with a line or bar chart.

( Fun: The twelve palette colours are sequenced in cyclic fifth inteverals. This order maximises the ability to distinguish between every colour that proceeds and follows it. This is the same as the circle of fifths in music theory )

Screen Greyscale printing

Linear colour wheel

Linear desaturated wheel

Sequenced colour wheel

Sequenced desaturated wheel

Code

Example Code

Line chart

Markup

                                                            <div id="line-chart" class="ace-chart">
                                                              <div class="ace-chart-container">
                                                                <svg></svg>
                                                              </div>
                                                            </div>
JavaScript

                                                            <script>
                                                              ACE.Chart
                                                                .Line(  '#line-chart svg'
                                                                      , lineData    // Array
                                                                      , { xAxisLabel : 'Time (s)'
                                                                        , yAxisLabel : 'Chocolate (g)'
                                                                        }
                                                                );
                                                              
                                                            </script>

Line chart with custom colours, interactive legend and guidelines

Markup

                                                            <div id="line-chart-user" class="ace-chart">
                                                              <div class="ace-chart-container">
                                                                <svg></svg>
                                                              </div>
                                                            </div>
JavaScript

                                                            <script>
                                                              ACE.Chart
                                                                .Line(  '#line-chart-user svg'
                                                                      , lineDataGalaxy    // Array
                                                                      , { xAxisLabel : 'Time'
                                                                        , yAxisLabel : 'Importance'
                                                                        , showLegend : true
                                                                        , manualColour : true
                                                                        , guidelines : true
                                                                        }
                                                                );
                                                              
                                                            </script>

Pie chart

Markup

                                                            <div id="pie-chart" class="ace-chart">
                                                              <div class="ace-chart-container">
                                                                <svg></svg>
                                                              </div>
                                                            </div>
JavaScript

                                                            <script>
                                                              ACE.Chart
                                                                .Pie( '#pie-chart svg'
                                                                    , pieData /* Array */
                                                                );
                                                              
                                                            </script>

Doughnut chart

Markup

                                                            <div id="doughnut-chart" class="ace-chart">
                                                              <div class="ace-chart-container">
                                                                <svg></svg>
                                                              </div>
                                                            </div>
JavaScript

                                                            <script>
                                                              ACE.Chart
                                                                .Doughnut( '#doughnut-chart svg'
                                                                    , doughnutData /* Array */
                                                                    , { insideText: 'Tasty'
                                                                      , colourOffset : 7
                                                                      , showLegend: true
                                                                      , legendPosition : 'top'
                                                                      }
                                                                );
                                                              
                                                            </script>

Usage

Include ace-charts-with-dependencies.css after ace.css


                                    <link rel="stylesheet" href="dist/ace.css" media="all">
                                    <link href="dist/extensions/ace-charts-with-dependencies.css" rel="stylesheet">

Include ace-charts-with-dependencies.js after ace.js


                                    <script src="dist/ace.js"></script>
                                    <script src="dist/extensions/ace-charts-with-dependencies.js"></script>

Call the chart library using this format:


                                    ACE.Chart
                                    .<chart-name>( <svg-selector-string>
                                                 , <data-array>
                                                 , <configuration-object>
                                    );
                                    

e.g.


                                    <script>
                                        ACE.Chart
                                          .Doughnut( '#my-chart svg'
                                              , [ { "label": "Hello", "value" : 12 }
                                                , { "label": "There", "value" : 34 }
                                                , { "label": "World", "value" : 56 }
                                                ]
                                              , { showLegend : true }
                                          );
                                    </script>
                                    

Chart Attributes

All charts

Attribute Examples Description
palette { palette : 'sequenced' }
{ palette : 'linear' }
Optional: Sets the colour palette. Defaults to sequened.
colourOffset { colourOffset : 7 } Optional: Sets the starting offset for the colour palette.
manualColour { manualColour : true } Optional: When true you need to add your own color property to the dataset.

Line chart

Attribute Examples Description
guidelines { guidelines : true } Optional: Show interactive guidelines. Defaults to false.
showLegend { showLegend : true } Optional: Show interactive legend. Defaults to false.
xAxisLabel { xAxisLabel : 'Time (hours)' } Text for the x-axis.
yAxisLabel { yAxisLabel : 'Value (AUD)' } Text for the y-axis.

Pie chart

Attribute Examples Description
showLabels { showLabels : true } Optional: Show outside labels. Defaults to false.
showLegend { showLegend : true } Optional: Show interactive legend. Defaults to false.
legendPosition { legendPosition : 'top' }
{ legendPosition : 'right' }
Optional: Sets the legend position. Defaults to right.

Doughnut chart

Attribute Examples Description
half { half : true } Optional: Show doughnut as a semicircle. Defaults to false.
showLabels { showLabels : true } Optional: Show outside labels. Defaults to false.
showLegend { showLegend : true } Optional: Show interactive legend. Defaults to false.
legendPosition { legendPosition : 'top' }
{ legendPosition : 'right' }
Optional: Sets the legend position. Defaults to right.
tooltipContent { tooltipContent : tip => tip.data.label } Optional: Function to change tooltip content.