jQuery UI Widgets Forums Chart Can anyone recommend tools for debugging: Chart?

This topic contains 1 reply, has 2 voices, and was last updated by  admin 3 months, 3 weeks ago.

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

  • sande
    Participant

    Can jqxChart display multiple value axes and how do I set that up in jQuery?


    admin
    Keymaster

    Hi sande,

    Yes, jqxChart can display multiple value axes, and you can configure them directly in the chart settings.
    You do this by defining extra objects inside the valueAxis array and then telling each series which axis it should use via series.valueAxis.

    Below is a clean example showing two value axes: one on the left and one on the right.

    $(document).ready(function () {
        var data = [
            { Month: "Jan", Sales: 120, Expenses: 80 },
            { Month: "Feb", Sales: 140, Expenses: 95 },
            { Month: "Mar", Sales: 160, Expenses: 70 }
        ];
    
        $('#chart').jqxChart({
            source: data,
            categoryAxis: {
                dataField: 'Month'
            },
    
            // ---- Multiple Value Axes ----
            valueAxis: [
                {
                    name: 'leftAxis',
                    position: 'left',
                    title: { text: 'Sales ($)' }
                },
                {
                    name: 'rightAxis',
                    position: 'right',
                    title: { text: 'Expenses ($)' }
                }
            ],
    
            // ---- Series linked to specific axes ----
            seriesGroups: [
                {
                    type: 'line',
                    columnsGapPercent: 50,
                    series: [
                        { dataField: 'Sales', displayText: 'Sales', valueAxis: 'leftAxis' },
                        { dataField: 'Expenses', displayText: 'Expenses', valueAxis: 'rightAxis' }
                    ]
                }
            ]
        });
    });

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

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

You must be logged in to reply to this topic.