jQuery UI Widgets Forums Chart jqxcharts is not wokring for crome and ie browser

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

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

  • shinaya
    Participant

    i am using the below code:- `
    $(document).ready(function() {
    // prepare the data
    var source = {
    datatype: “json”,
    timeout: ‘5000’,
    datafields: [
    {name: ‘FeedbackCount’ },
    {name: ‘CommentTime’},
    ],
    url: “/users/dashboardjson”
    };

    var dataAdapter = new $.jqx.dataAdapter(source, {
    autoBind: true,
    //async: true,
    beforeLoadComplete: function(records, originalData, c) {
    FeedbackCountMax = 0;
    for (var i = 0; i < records.length; i++) {
    if (originalData[i].FeedbackCount > FeedbackCountMax) {
    FeedbackCountMax = originalData[i].FeedbackCount;
    }
    }
    FeedbackCountMax = Math.ceil(FeedbackCountMax / 10) * 10;
    return records;
    },
    loadComplete: function (records) {
    LoadNoFeedbackChart(dataAdapter);
    },
    });
    });

    function LoadNoFeedbackChart(dataAdapter){

    var settings = {
    title: “Feed”,
    showLegend: true,
    source: dataAdapter,
    xAxis: {
    dataField: ‘CommentTime’,
    gridLines: {
    visible: true
    },
    baseUnit: ‘days’,
    valuesOnTicks: true,
    minValue: GraphMinValue,// value define in core.php
    maxValue: GraphMaxValue, // value define in core.php
    },
    colorScheme: ‘scheme04’,
    valueAxis: {
    displayValueAxis: true,
    maxValue: FeedbackCountMax,
    minValue: 0,
    title: { text: ‘Feedback Count<br>’},
    },
    seriesGroups: [{
    type: ‘spline’,
    series: [
    { dataField: ‘FeedbackCount’, displayText: ‘feed’},
    ]
    }]
    };
    $(‘#chartContainer’).jqxChart(settings);
    }`

    json is [{“FeedbackCount”:”1″,”CommentTime”:”04-04-2015″},{“FeedbackCount”:”4″,”CommentTime”:”07-04-2015″},{“FeedbackCount”
    :”4″,”CommentTime”:”08-04-2015″},{“FeedbackCount”:”1″,”CommentTime”:”09-04-2015″},{“FeedbackCount”:”3″
    ,”CommentTime”:”10-04-2015″},{“FeedbackCount”:”1″,”CommentTime”:”11-04-2015″}]
    the above code works in firfox but not in crome and ie


    Dimitar
    Participant

    Hello shinaya,

    Please modify your code as follows:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdraw.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxchart.core.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                // prepare the data
                var source = {
                    datatype: "json",
                    timeout: '5000',
                    datafields: [{
                        name: 'FeedbackCount'
                    }, {
                        name: 'CommentTime'
                    }],
                    url: "/users/dashboardjson"
                };
    
                var FeedbackCountMax = 0;
    
                var dataAdapter = new $.jqx.dataAdapter(source, {
                    autoBind: true,
                    //async: true,
                    beforeLoadComplete: function (records, originalData, c) {
                        for (var i = 0; i < records.length; i++) {
                            if (originalData[i].FeedbackCount > FeedbackCountMax) {
                                FeedbackCountMax = originalData[i].FeedbackCount;
                            }
                        }
                        FeedbackCountMax = Math.ceil(FeedbackCountMax / 10) * 10;
                        return records;
                    }
                });
    
                var settings = {
                    title: "Feed",
                    showLegend: true,
                    source: dataAdapter,
                    xAxis: {
                        dataField: 'CommentTime',
                        gridLines: {
                            visible: true
                        },
                        baseUnit: 'days',
                        valuesOnTicks: true
                        //                    minValue: GraphMinValue, // value define in core.php
                        //                    maxValue: GraphMaxValue  // value define in core.php
                    },
                    colorScheme: 'scheme04',
                    valueAxis: {
                        displayValueAxis: true,
                        maxValue: FeedbackCountMax,
                        minValue: 0,
                        title: {
                            text: 'Feedback Count<br>'
                        }
                    },
                    seriesGroups: [{
                        type: 'spline',
                        series: [{
                            dataField: 'FeedbackCount',
                            displayText: 'feed'
                        }]
                    }]
                };
                $('#chartContainer').jqxChart(settings);
            });
        </script>
    </head>
    <body class='default'>
        <div id='chartContainer' style="width: 850px; height: 400px;">
        </div>
    </body>
    </html>

    Best Regards,
    Dimitar

    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.