jQWidgets Forums

jQuery UI Widgets Forums Chart How to set Description with the value of a field

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

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

  • raffaele
    Member

    Hi, i want set Description with value of a field:

                                            ...
    var sqlData =
    {
    datatype: "json",
    datafields: [
    { name: 'sezione'},
    { name: 'voti'},
    { name: 'data'},
    ],
    url: '/customcode/liveCandidati2013.php?candidato='+candidato_par,
    };
    var dataAdapterSez = new $.jqx.dataAdapter(sqlData);
    var my_date = dataAdapterSez.records[0].data;
    var settingsSez = {
    title: "Distribuzione per sezioni "+item.label,
    description: "Statistiche live del: "+my_date,
    ...

    help me please?


    Dimitar
    Participant

    Hello raffaele,

    The solution is similar to the example provided by you:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en">
    <head>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxchart.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    // prepare the data
    var source =
    {
    datatype: "tab",
    datafields: [
    { name: 'Date' },
    { name: 'Referral' },
    { name: 'SearchPaid' },
    { name: 'SearchNonPaid' }
    ],
    url: '../sampledata/website_analytics.txt'
    };
    var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert('Error loading "' + source.url + '" : ' + error); } });
    var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
    // prepare jqxChart settings
    var settings = {
    title: "Web Traffic Analysis",
    description: "Unique site visitors (" + dataAdapter.records[0].Date + ")",
    enableAnimations: true,
    showLegend: true,
    padding: { left: 10, top: 5, right: 10, bottom: 5 },
    titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },
    source: dataAdapter,
    categoryAxis:
    {
    type: 'date',
    baseUnit: 'day',
    textRotationAngle: 0,
    dataField: 'Date',
    formatFunction: function (value) {
    return value.getDate();
    },
    toolTipFormatFunction: function (value) {
    return value.getDate() + '-' + months[value.getMonth()] + '-' + value.getFullYear();
    },
    showTickMarks: true,
    tickMarksInterval: 1,
    tickMarksColor: '#888888',
    unitInterval: 1,
    showGridLines: true,
    gridLinesInterval: 30,
    gridLinesColor: '#888888',
    valuesOnTicks: true
    },
    colorScheme: 'scheme06',
    seriesGroups:
    [
    {
    type: 'stackedarea100',
    valueAxis:
    {
    unitInterval: 20,
    displayValueAxis: true,
    description: 'Daily visitors',
    tickMarksColor: '#888888'
    },
    series: [
    { dataField: 'SearchNonPaid', displayText: 'Organic Search Traffic' },
    { dataField: 'SearchPaid', displayText: 'Paid Search Traffic' },
    { dataField: 'Referral', displayText: 'Referral Traffic' }
    ]
    }
    ]
    };
    // setup the chart
    $('#jqxChart').jqxChart(settings);
    });
    </script>
    </head>
    <body class='default'>
    <div id='jqxChart' style="width: 680px; 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.