jQuery UI Widgets Forums Chart Horizontal Line to show mean

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Horizontal Line to show mean #74942

    drv232
    Participant

    Is it possible to show an additional line (maybe dotted) in the chart to show the mean of the graph?

    The chart does not need to calculate the mean. Mean can be calculated using php. Is there a way to specify a point on the y axis and show a dotted line parallel to the x-axis?

    My code to the chart is as follows:

    
    var source =
                {
                    datatype: "json",
                    datafields: [
                        { name: 'Mdate' },
                        
                        { name: 'diff' }
                        
                    ],
                    url: 'chartTestDiffData.php'
                };
                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: "Daily Hedge Data",
                    description: "Difference",
                    enableAnimations: true,
                    showLegend: true,
                    padding: { left: 15, top: 5, right: 20, bottom: 5 },
                    titlePadding: { left: 10, top: 0, right: 0, bottom: 10 },
                    source: dataAdapter,
                    xAxis:
                        {
                            type:'basic',
                            dataField: 'Mdate',
                            //minValue: 20150810,
                           // maxValue: 20150814,
                            //unitInterval: 1,
                            valuesOnTicks: true,
                            textRotationAngle: -90,
                        },
                    colorScheme: 'scheme05',
                    seriesGroups:
                        [
                            {
                                type: 'spline',
                                alignEndPointsWithIntervals: false,
                                valueAxis:
                                {
                                    //title: {text: 'Interest Rate'},
                                    position: 'right',
                                    unitInterval: 0.5,
                                    //maxValue: 0.2,
                                    labels: {formatSettings: { decimalPlaces: 1}},
                                    tickMarks: {
                                        visible: true,
                                        interval: 0.005,
                                    },
                                    gridLines: {
                                        visible: true,
                                        interval: 0.01
                                    }
                                },
                                series: [
                                        { dataField: 'diff', displayText: 'diff', opacity: 0.9 }
                                    ]
                            }
                        ]
                    };
                
                $('#diffChartContainer').jqxChart(settings);
    
    
    Horizontal Line to show mean #74952

    ivailo
    Participant

    Hi drv232,

    You can use chart annotation + band.
    Here is the demo.

    Best Regards,
    Ivailo Ivanov

    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.