AnsweredAssumed Answered

PI Vision Custom Symbol Bar Chart does not show values greater than 1000

Question asked by rickyjoerescar on Oct 22, 2018
Latest reply on May 12, 2019 by BlueStar

Hi,

 

So I implemented a custom bar chart in pi vision. I don't have any problem except for this 1 tag that has a value of around 1800. As seen below, I can display sinusoid values using the custom symbol however it is different when I add the tag in question.

 

 

 

I tried other symbols and they don't have any problem displaying it's values.

 

Code is below:

 

(function (CS) {

    'use strict';

 

 

    function symbolVis() { }

    CS.deriveVisualizationFromBase(symbolVis);

 

 

    symbolVis.prototype.init = function(scope, elem) {

        this.onDataUpdate = dataUpdate;

        this. = resize;

 

 

        var container = elem.find('#container')[0];

        var id = 'timeseries_' + Math.random().toString(36).substr(2, 16);

        container.id = id;

 

 

        function convertToChartData(data) {

            var series = [];

            data.Data.forEach(function(item) {

                var t = {};

                t.name = item.Label;

                t.data = item.Values.map(function(obj) {

                    var date = new Date(obj.Time);

                    // please note, Number(obj.Value) will only work with numbers with . as the decimal separator

                    return [Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(),  date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()), Number(obj.Value)];

                });

                series.push(t);

            });

 

 

            return series;           

        }

 

 

        var chart;

        function dataUpdate(data) {

            if(data) {

                var series = convertToChartData(data);

                if(!chart) {

                    chart = new Highcharts.Chart({

                        chart: {

                            type: 'column',

                            renderTo: id

                        },

                        title: {

                            text: ''

                        },

                        xAxis: {

                            type: 'datetime',

                            dateTimeLabelFormats: { // don't display the dummy year

                                month: '%e. %b',

                                year: '%b'

                            },

                            title: {

                                text: 'Date'

                            }

                        },

 

 

 

                        plotOptions: {

                            column: {

                                marker: {

                                    enabled: true

                                }

                            }

                        },

                        series: series

                    });

                } else {

                    series.forEach(function(item, index) {

                        if(chart.series[index]) {

                            chart.series[index].setData(item.data);

                        } else {

                            chart.addSeries(item);

                        }

                    });

                }

            }

        }

       

        function resize(width, height) {

            if(chart) {

                chart.setSize(width, height);

            }

        }

 

 

    };

   

    var defintion = {

        typeName: 'timeserieschart',

        datasourceBehavior: CS.Extensibility.Enums.DatasourceBehaviors.Multiple,

        visObjectType: symbolVis,

        getDefaultConfig: function() {

            return {

                DataShape: 'TimeSeries',

                DataQueryMode:  CS.Extensibility.Enums.DataQueryMode.ModePlotValues,

                Interval: 500,

                Height: 200,

                Width: 400

            };

        }

    };

    CS.symbolCatalog.register(defintion);

})(window.PIVisualization);

Outcomes