jQuery UI Widgets Forums Chart Bands through the Y-axis

This topic contains 2 replies, has 2 voices, and was last updated by  ziggy 8 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Bands through the Y-axis #72318

    ziggy
    Participant

    Hi,

    Is it possible to create bands through the Y-axis? If possible, can you provide a sample code?

    Thanks!

    Bands through the Y-axis #72321

    Dimitar
    Participant

    Hi Karen,

    Perhaps the following example demonstrates what you are looking for:

    <!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/jqxdata.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">
            $(document).ready(function () {
                // prepare the data
    
                var data = [
                    { Person: "Planning", M1_From: 2, M1_To: 5, M2_From: 5, M2_To: 10 },
                    { Person: "Dev 1", M1_From: 5, M1_To: 7, M2_From: 9, M2_To: 17 },
                    { Person: "Dev 2", M1_From: 5, M1_To: 12, M2_From: 14, M2_To: 22 },
                    { Person: "QA 1", M1_From: 7, M1_To: 14, M2_From: 14, M2_To: 25 }
                    ];
    
                var toolTipCustomFormatFn = function (value, itemIndex, serie, group, categoryValue, categoryAxis) {
                    var dataItem = data[itemIndex];
                    return '<DIV style="text-align:left"><b>Team: ' + categoryValue +
                            '</b><br />Start day: ' + value.from +
                            '<br />End day: ' + value.to;
                };
    
                // prepare jqxChart settings
                var settings = {
                    title: "Monthly Project Schedule",
                    description: "Website update plan",
                    enableAnimations: true,
                    showLegend: true,
                    padding: { left: 5, top: 5, right: 10, bottom: 5 },
                    titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },
                    source: data,
                    xAxis:
                    {
                        dataField: 'Person',
                        unitInterval: 1,
                        tickMarks: {
                            visible: true,
                            interval: 1,
                            color: '#BCBCBC'
                        }
                    },
                    colorScheme: 'scheme03',
                    seriesGroups:
                        [
                            {
                                type: 'rangecolumn',
                                columnsGapPercent: 100,
                                toolTipFormatFunction: toolTipCustomFormatFn,
                                valueAxis:
                                {
                                    flip: true,
                                    minValue: 1,
                                    maxValue: 30,
                                    unitInterval: 1,
                                    title: { text: 'Day' },
                                    tickMarks: { color: '#BCBCBC' }
                                },
                                series: [
                                        { dataFieldFrom: 'M1_From', dataFieldTo: 'M1_To', displayText: 'Sprint 1', opacity: 1 },
                                        { dataFieldFrom: 'M2_From', dataFieldTo: 'M2_To', displayText: 'Sprint 2', opacity: 1 }
                                    ],
                                bands:
                                [
                                    { minValue: 13, maxValue: 16, color: '#00FF00', opacity: 0.15 },
                                    { minValue: 24, maxValue: 27, color: '#0000FF', opacity: 0.20 },
                                    { minValue: 29, maxValue: 29, color: '#FF0000', opacity: 0.5, lineWidth: 3 }
                                ]
                            }
    
                        ]
                };
    
                // setup the chart
                $('#chartContainer').jqxChart(settings);
            });
        </script>
    </head>
    <body class='default'>
        <div id='chartContainer' style="width: 850px; height: 500px">
        </div>
    </body>
    </html>

    Best Regards,
    Dimitar

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

    Bands through the Y-axis #72515

    ziggy
    Participant

    Thanks Dimitar!

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

You must be logged in to reply to this topic.