/*
 * Copyright 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
 * Please see distribution for license.
 */
$.register_module({
    name: 'og.analytics.Formatter',
    dependencies: ['og.analytics.Grid'],
    obj: function () {
        var module = this;
        $.fn.sparkline.defaults.common.disableHiddenCheck = true;
        return function (grid) {
            var formatter = this;
            formatter.DOUBLE = function (value) {
                var curr, last, indicator = !value || !value.h || !value.h.length ? null
                    : (curr = value.h[value.h.length - 1]) < (last = value.h[value.h.length - 2]) ? 'down'
                        : curr > last ? 'up' : 'static';
                return !value ? ''
                    : (curr < 0 ? '<span class="og-neg">' + value.v + '</span>' : value.v || '') +
                        (grid.config.sparklines ? '<span class="sp" values="' + value.h.join(',') + '"></span>' : '') +
                        (indicator ? '<span class="OG-icon og-icon-tick-'+ indicator +'"></span>' : '');
            };
            formatter.UNKNOWN = function (value) {
                var type = value.t;
                return value && formatter[type] ? formatter[type](value) : value && value.v || '';
            };
            formatter.CURVE = function (value) {
                return '<span class="fl">[' + JSON.stringify(value.v) + ']</span>'
            };
            grid.on('render', function () {
                var sp_options = {
                    type: 'line', lineColor: '#b0b0b0', fillColor: '#ecedee', spotColor: '#b0b0b0',
                    minSpotColor: '#b0b0b0', maxSpotColor: '#b0b0b0', disableInteraction: true
                };
                grid.elements.parent.find('.OG-g .sp').sparkline('html', sp_options);
                grid.elements.parent.find('.OG-g .fl').each(function () {
                    var $this = $(this), data;
                    try {data = JSON.parse($this.text());} catch (error) {return;}
                    $.plot($this, data, {
                        colors: ['#456899'],
                        grid: {borderWidth: 0, minBorderMargin: 1},
                        series: {shadowSize: 0, lines: {lineWidth: 1}},
                        xaxis: {show: false}, yaxis: {show: false}
                    });
                });
            });
        };
    }
});

@@ -1953,16 +1953,41 @@
    try %7B
+%0A                        
 data = J
@@ -2014,34 +2014,13 @@
 ());
-%7D catch (error) %7Breturn;%7D%0A
+%0A    
     
@@ -2081,16 +2081,20 @@
         
+    
 colors: 
@@ -2102,24 +2102,28 @@
 '#456899'%5D,%0A
+    
             
@@ -2202,16 +2202,20 @@
         
+    
 series: 
@@ -2254,16 +2254,20 @@
 h: 1%7D%7D,%0A
+    
         
@@ -2337,35 +2337,85 @@
                 
-%7D);
+    %7D);%0A                    %7D catch (error) %7Breturn;%7D
 %0A               

add curve formatter flot into try catch block