jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
100 lines (94 loc) • 4.61 kB
HTML
<html ng-app="demoApp" lang="en">
<head>
<title id='Description'>AngularJS Chart Range Selector Example</title>
<meta name="description" content="This is an example of AngularJS Chart. Chart Range Selector and Zooming." />
<link rel="stylesheet" type="text/css" href="../../../jqwidgets/styles/jqx.base.css" />
<script type="text/javascript" src="../../../scripts/angular.min.js"></script> <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" src="../../../jqwidgets/jqxangular.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxchart.rangeselector.js"></script>
<script type="text/javascript">
var demoApp = angular.module("demoApp", ["jqwidgets"]);
demoApp.controller("demoController", function ($scope) {
// prepare the data
var source =
{
datatype: "csv",
datafields: [
{ name: 'Date' },
{ name: 'Open' },
{ name: 'High' },
{ name: 'Low' },
{ name: 'Close' },
{ name: 'Volume' },
{ name: 'AdjClose' }
],
url: '../../sampledata/TSLA_stockprice.csv'
};
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) {
return 'Index: ' + itemIndex + ", Value: " + value;
};
// prepare jqxChart settings
var settings = {
title: "Range selector with regular x-axis",
description: "In this example the range selector works with (non-date) axis",
enableAnimations: true,
showLegend: false,
animationDuration: 1500,
enableCrosshairs: true,
padding: { left: 5, top: 5, right: 20, bottom: 5 },
colorScheme: 'scheme02',
source: dataAdapter,
xAxis:
{
minValue: 150,
maxValue: 550,
flip: false,
valuesOnTicks: false,
rangeSelector: {
serieType: 'area',
padding: { /*left: 0, right: 0,*/ top: 30, bottom: 0 },
// Uncomment the line below to render the selector in a separate container
//renderTo: $('#selectorContainer'),
backgroundColor: 'white',
size: 150,
showGridLines: false,
}
},
seriesGroups:
[
{
type: 'line',
toolTipFormatFunction: toolTipCustomFormatFn,
valueAxis:
{
flip: false,
description: 'Value<br><br>'
},
series: [
{ dataField: 'Close', lineWidth: 1, lineWidthSelected: 1 }
]
}
]
};
$scope.chartSettings = settings;
});
</script>
</head>
<body ng-controller="demoController">
<p>
<jqx-chart jqx-settings="chartSettings" style="width:800px; height:500px;">
</jqx-chart>
</p>
<p>
<!-- you can optionally render the selecor in this container -->
<div id='selectorContainer' style="width:500px; height:100px;">
</div>
</p>
</body>
</html>