jqxChart requires the following files:
jqx.base.cssjqxcore.jsjqxdata.jsjqxdraw.jsjqxchart.core.jsjqxchart.rangeselector.jsjqxchart.annotations.jsjqxchart.waterfall.js<script src="~/jqwidgets/jqxchart.js"></script>
@model IEnumerable<jQWidgets.AspNet.Core.Models.StockPrice>
@using jQWidgets.AspNetCore.Mvc.TagHelpers;
@{
ViewData["Title"] = "ASP .NET MVC Zooming Chart Example";
Padding padding = new Padding() { Left = 5, Top = 5, Right = 30, Bottom = 5 };
Padding titlePadding = new Padding() { Left = 30, Top = 5, Right = 0, Bottom = 10 };
Rectangle legendPosition = new Rectangle(){ Left = 520, Top = 140, Width = 100, Height = 100 };
FormatSettings formatSettings = new FormatSettings() { Sufix = "%", DecimalPlaces = 1 };
DateTime minDate = new DateTime(2012, 1, 1);
DateTime maxDate = new DateTime(2013, 12, 31);
}
<script>
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
function labelsCustomFormatFn (value) {
return value.getDate() + '-' + months[value.getMonth()] + '\'' + value.getFullYear().toString().substring(2);
};
function rangeSelectorLabelsCustomFormatFn(value) {
return value.getDate() + '-' + months[value.getMonth()] + '\'' + value.getFullYear().toString().substring(2);
};
function toolTipCustomFormatFn(value, itemIndex, serie, group, categoryValue, categoryAxis) {
var dataItem = dataAdapter.records[itemIndex];
return '<DIV style="text-align:left"><b>Date: ' +
category-value.getDate() + '-' + months[categoryValue.getMonth()] + '-' + categoryValue.getFullYear() +
'</b><br />Open price: $' + dataItem.Open +
'</b><br />Close price: $' + dataItem.Close +
'</b><br />Daily volume: ' + dataItem.Volume +
'</DIV>';
};
</script>
<jqx-chart style="width: 850px; height: 500px;" title="My Title" source="Model">
<jqx-chart-x-axis type="AxisType.Date" base-unit="BaseUnit.Day" datafield="Date" min-value="minDate" max-value="maxDate">
<jqx-chart-range-selector size="80" min-value="minDate" datafield="Close" base-unit="BaseUnit.Month" serieType="SerieType.Area" background-color="white">
<jqx-chart-labels format-function="rangeSelectorLabelsCustomFormatFn()"></jqx-chart-labels>
</jqx-chart-range-selector>
<jqx-chart-labels format-Function="labelsCustomFormatFn()"></jqx-chart-labels>
</jqx-chart-x-axis>
<jqx-chart-value-axis text="Price per share [USD]">
<jqx-chart-labels horizontal-aligment="HorizontalAlignment.Right"></jqx-chart-labels>
</jqx-chart-value-axis>
<jqx-chart-series-groups>
<jqx-chart-serie-group toolTip-format-function=toolTipCustomFormatFn() type=SerieType.Line>
<jqx-chart-series>
<jqx-chart-serie datafield='Close' display-text='Close Price' line-width="1" line-width-selected="1"></jqx-chart-serie>
</jqx-chart-series>
</jqx-chart-serie-group>
</jqx-chart-series-groups>
</jqx-chart>