Home forums Using CanvasJS Date axis Chart with Crosshair

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27875

    On the Chart with Crosshair, at code examples, in Controller section, there is the following code:

    public ContentResult JSON()
    {
    List<DataPoint> dataPoints = new List<DataPoint>();

    dataPoints.Add(new DataPoint(1481999400000, 4.67));
    dataPoints.Add(new DataPoint(1482604200000, 4.7));
    dataPoints.Add(new DataPoint(1483209000000, 4.96));
    dataPoints.Add(new DataPoint(1483813800000, 5.12)); //1483813800000 gets materialized into a date
    ….etc
    }

    What date type is the first value of the DataPoint?(e.g 1483813800000). How can i convert a normal C# DateTime to this format(double)? I tried .ToOADate() and didnt succeed.

    #27941

    @catahotea,

    Please take a look at this StackOverflow thread for more information on converting c# DateTime to JavaScript timestamp.

    ___________
    Indranil Deo
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.