Home Forums Chart Support Date on axis from C# MVC Reply To: Date on axis from C# MVC

#42072

I am just getting warmed up to canvasJS so forgive me if I am clunky in asking my question.

I am trying to use this javascript example;

var dps = [
  { x: new Date(2012,00,01), y: [new Date(2016, 1, 15, 8, 16, 15), new Date(2016, 1, 15, 9, 16, 15)] },  // y: [Low ,High]
  { x: new Date(2012,00,01), y: [new Date(2016, 1, 15, 11, 20, 15), new Date(2016, 1, 15, 13, 20, 15)] },
  { x: new Date(2012,02,01), y: [new Date(2016, 1, 15, 5, 16, 15), new Date(2016, 1, 15, 8, 30, 15)] },
  { x: new Date(2012,03,01), y: [new Date(2016, 1, 15, 4, 12, 15), new Date(2016, 1, 15, 12, 1, 15)] },
  { x: new Date(2012,04,01), y: [new Date(2016, 1, 15, 8, 16, 15), new Date(2016, 1, 15, 9, 00, 15)] },
  { x: new Date(2012,05,01), y: [new Date(2016, 1, 15, 7, 16, 15), new Date(2016, 1, 15, 10, 18, 15)] },
];

formatted for c# MVC CONTROLLER;


           dataPoints.Add(new DataPoint(new DateTime(2012,00,01), new DateTime(2016, 1, 15, 8, 16, 15), new DateTime(2016, 1, 15, 9, 16, 15)));
            dataPoints.Add(new DataPoint(new DateTime(2012,00,02), new DateTime(2016, 1, 15, 11, 20, 15), new DateTime(2016, 1, 15, 13, 20, 15));
            dataPoints.Add(new DataPoint(new DateTime(2012,00,03), new DateTime(2016, 1, 15, 5, 16, 15), new DateTime(2016, 1, 15, 8, 30, 15));

But the MVC version does not draw anything on the table. So I think my formatting is wrong.

Any ideas of the correct C# formatting?