Vote count: 0
I'm trying to implement a UK formatted date picker for the range selector in Highstock using the MVC wrappers, and cannot seem to establish the correct syntax (all examples I have seen initialize the chart using javascript). Is anyone able to help me understand how to initialize the chart using MVC html helpers in such a way that it will accept dates in the UK format 'dd/mm/yyyy', and by integrating a datepicker using this UK format? The code below does not seem to apply the output of the 'formatDate' function to the input box, and I would like to know how to get the date picker working:
<script type="text/javascript">
function formatDate(value) {
value = value.split("/");
return Date.UTC(
1970,
0,
1,
parseInt(value[0]),
parseInt(value[1]),
parseInt(value[2])
);
}
</script>
@(Html.Highsoft().Highstock(
new Highstock
{
Chart = Model.Stock,
Title = Model.Title,
Subtitle = Model.SubTitle,
Series = Model.Series,
Tooltip = Model.Tooltip,
Credits = Model.Credits,
XAxis = Model.XAxis,
YAxis = Model.YAxis,
PlotOptions = Model.PlotOptions,
Legend = Model.Legend,
RangeSelector = {
Selected = 1,
InputDateFormat = "%d/%m/%Y",
InputEditDateFormat = "%d/%m/%Y",
InputDateParser = "function (value) { formatDate(value); }"
}
},
"myChartName"))
Please bear in mind that I am looking for the correct MVC wrapper syntax to get this working, not the javascript implementation and I would like to use an integrated datepicker.
Implementing Date Picker on Highstock MVC Chart
Aucun commentaire:
Enregistrer un commentaire