p500.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']; var toolTipCustomFormatFn = function (value, itemIndex, serie, group, categoryValue, categoryAxis) { var dataItem = dataAdapter.records[itemIndex]; return '
Date: ' + categoryValue.getDate() + '-' + months[categoryValue.getMonth()] + '-' + categoryValue.getFullYear() + '

NASDAQ: ' + dataAdapter.formatNumber(dataItem['NASDAQ'], 'f') + '
S&P 500: ' + dataAdapter.formatNumber(dataItem['S&P 500'], 'f') + '
'; }; // prepare jqxChart settings var settings = { title: "U.S. Stock Market Index Performance (2011)", description: "NASDAQ Composite compared to S&P 500", enableAnimations: true, showLegend: true, enableCrosshairs: true, padding: { left: 10, top: 5, right: 30, bottom: 5 }, titlePadding: { left: 10, top: 0, right: 30, bottom: 10 }, source: dataAdapter, xAxis: { dataField: 'Date', formatFunction: function (value) { return value.getDate() + '-' + months[value.getMonth()] + '-' + value.getFullYear(); }, type: 'date', baseUnit: 'month', showTickMarks: true, tickMarksInterval: 1, tickMarksColor: '#888888', unitInterval: 1, showGridLines: true, gridLinesInterval: 3, gridLinesColor: '#888888', valuesOnTicks: true, minValue: '01-01-2011', maxValue: '01-01-2012', textRotationAngle: -45 }, colorScheme: 'scheme05', seriesGroups: [ { type: 'spline', toolTipFormatFunction: toolTipCustomFormatFn, valueAxis: { unitInterval: 500, minValue: 0, maxValue: 3000, displayValueAxis: true, description: 'Daily Closing Price', axisSize: 'auto', tickMarksColor: '#888888' }, series: [ { dataField: 'S&P 500', displayText: 'S&P 500' }, { dataField: 'NASDAQ', displayText: 'NASDAQ' } ] } ] }; // setup the chart $('#chartContainer').jqxChart(settings); });