jQWidgets Forums

jQuery UI Widgets Forums Chart line chart JSON

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 9 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • line chart JSON #83484

    atomic
    Participant

    Hi,

    I have working line chart. It reads JSON file and plots data.
    Here is code.

    function Chart(tech, year, casename) {
    
        //this.myURL2 ='phase2/HourlyAnalysis_data.php?action=chartData&tech='+tech+'&year='+year;
        this.myURL2 ='phase2/data/'+casename+'/'+tech+'cp.json';
        this.srcChart =
        {
            url: this.myURL2,
            root: year.toString(),
            datatype: 'json',
            cache: true,
            async: true,
        }; 
        
        this.ChartSetting = function(daChart){
            settings={
            title: tech+' for year '+year,
            description: "",
            padding: {
             left: 5,
             top: 5,
             right: 5,
             bottom: 5
            },
            titlePadding: {
             left: 0,
             top: 0,
             right: 0,
             bottom: 10
            },
            source: daChart,
            enableAnimations: true,
            categoryAxis: {
             dataField: 'hour',
             description: '',
             showGridLines: true,
             showTickMarks: true
            },
            seriesGroups: [{
             type: 'line',
             valueAxis: {
                 description: 'Value',
                 logarithmicScale: true,
                 logarithmicScaleBase: 2,
                 unitInterval: 1,
                 tickMarksInterval: 1,
                 gridLinesInterval: 1,
                 formatSettings: {
                     decimalPlaces: 3
                 },
            
                 horizontalTextAlignment: 'right'
             },
             series: [{
                 dataField: 'value',
                 displayText: 'Hour Value'
             }]
            }]
            };
            return settings;
        };
      }
    
      var chart = new Chart(tech, year, casename); 
      var daChart = new $.jqx.dataAdapter(chart.srcChart,{ loadComplete: function () { $('#jqxLoader').jqxLoader('close'); }});  
      $('#jqxChart').jqxChart(chart.ChartSetting(daChart));

    It plots 8760 values for every year. I have three questions
    1. It has some delay after data is loaded, is there any setting to speed up the plotting of chart?
    2. It does not plot anything on chart if my json has values for 10 elements and the rest (8750) elemetns are 0!!
    3. Could you please explain in little bit more detail what this setting is for logarithmicScale: true, logarithmicScaleBase: 2,

    Thank you very much!
    Great widgets by the way!!

    line chart JSON #83521

    Hristo
    Participant

    Hello atomic,

    About 1. and 2. could you try to create in right sequence first ‘source’ next one is ‘dataAdapter’ and then are Chart settings.
    Also when you update the Chart with new data first set new url: link, dataAdapter.dataBind(); and on the end – chart.update();.
    Please, take a look this demo:
    http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/javascript_chart_live_updates_perf.htm?light
    3. This properties are useful when you need to show data by a wide margin
    logarithmicScale – a boolean representing whether to use logarithmic scale. The default value is false.
    logarithmicScaleBase – an integer representing the base of logarithmic scale. The default value is 10.
    We have many demos with this options.
    To find more about this could visit our API Documentation.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.