jQuery UI Widgets Forums Chart Facing problem with PIE chart

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 9 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Facing problem with PIE chart #63469

    harishmaney
    Participant

    Sorry for posting the wrong question in wrong forum.

    Here is my sample code snippet…

    function drawPieTokenChart() {

    // prepare chart data as an array
    var source =
    {
    datatype: “csv”,
    datafields: [
    { name: ‘Token’ },
    { name: ‘Count’ }
    ],
    url: $(‘#hdnPieChartData’).val() + ‘?t=’ + new Date().getTime()
    };
    var dataAdapter = new $.jqx.dataAdapter(source, {
    async: false, autoBind: true, loadError: function (xhr, status, error) { //alert(‘Error loading “‘ + source.url + ‘” : ‘ + error);
    }
    });
    // prepare jqxChart settings
    var settings = {
    title: token,
    description: “”,
    enableAnimations: true,
    showLegend: true,
    showBorderLine: true,
    //padding: { left: 5, top: 5, right: 5, bottom: 5 },
    //titlePadding: { left: 0, top: 0, right: 0, bottom: 10 },
    source: dataAdapter,
    colorScheme: ‘scheme03’,
    seriesGroups:
    [
    {
    type: ‘pie’,
    showLabels: false,
    series:
    [
    {
    dataField: ‘Count’,
    displayText: ‘Token’,
    labelRadius: 45,
    initialAngle: 0,
    radius: 125,
    centerOffset: 0,
    offsetY: 200,
    formatFunction: function (value) {
    if (isNaN(value))
    return value;
    return parseFloat(value) + ‘%’;
    },
    }
    ]
    }
    ]
    };
    // setup the chart
    $(‘#pieChart’).jqxChart(settings);
    }

    $(‘#hdnPieChartData’).val() – contains the path of the csv file from where I am reading the data.

    Thanks,
    Harish

    Facing problem with PIE chart #63478

    Dimitar
    Participant

    Hello Harish,

    Instead of your formatFunction, you may try applying the formatSettings property as follows:

    formatSettings: { sufix: '%' }

    If the issue persists, please share some sample data so that we may test your code. Remember to format your sample snippet by selecting it and pressing the code button in the toolbar.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Facing problem with PIE chart #63512

    harishmaney
    Participant

    Hi Dimitar,

    Still, it does not solve the issue of NaN. If I remove formatFunction and use formatSettings {sufix:’%’}, I can still see an empty legend displayed.
    Any idea, why?

    Thanks,
    Harish. P

    Facing problem with PIE chart #63514

    Dimitar
    Participant

    Hi Harish. P,

    Please share some sample data so that we may test your code and see what causes the issue. Remember to format your sample snippet by selecting it and pressing the code button in the toolbar. Alternatively, post a JSFiddle example.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.