Back

Using value function

Two series - one shows only positive values another negative values.

Documentation Open in JSFiddle
Start Free Trial Purchase

HTML

HTML
<script src="https://cdn.zoomcharts-cloud.com/1/nightly/zoomcharts.js"></script>

<div id="demo"></div>

CSS

CSS
//No CSS for this example 

JavaScript

JavaScript

    var t = new TimeChart(
            {
                container: document.getElementById("demo"),
                data:
                {
                    units:["h"],
                    url: "/dvsl/data/time-chart/temperature-kuldiga-h.json"
                },
                valueAxisDefault:{ title:"Temperature" },
                series:[
                    {
                        name:"Average temperature",
                        id:"series1",
                        type:"columns",
                        stack:"s1",
                        data:{
                            index: 1,
                            aggregation:"avg",
                            aggregatedValueFunction:function(value){return value > 0 ? value : null;
                            }
                        },
                        style:{
                            fillColor:"orange"
                        }
                    },
                    {
                        name:"Average temperature",
                        id:"series2",
                        type:"columns",
                        stack:"s1",
                        data:{
                            index: 1,
                            aggregation:"avg",
                            aggregatedValueFunction:function(value){return value < 0 ? value : null;}
                        },
                        style:{
                            fillColor:"blue"
                        }
                    }
                ],
                stacks:{
                    "s1":{
                        type:"based"
                    }
                },
                info:{
                    showNoData: false
                }
            }
    );

Data

Data
//Data too large to output
Download Data