Home forums Chart Support Don’t see any data on graphic (MVC)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #28671

    Hello,

    I followed the tutorial on Creating Charts from External JSON Data API
    but now when I start the website I have no data on the graphic. Can it because I have some css on because when I make a new solution without css or bootstrap or something it works perfect

    Can someone help me? I am new to Canvasjs.

    thanks in advance.

    #28678

    @den_boey,

    Can you kindly create a sample project reproducing the issue and share it over Google-Drive or Onedrive along with the sample data so that we can look into the code, run it locally to understand the scenario better and help you resolve?

    From what we have observed, sometimes things get delayed mostly when we are not able to reproduce the issue or not able to understand the exact requirements or the solution that we provide may not work properly due to the variation in chart-options being used by you and us.

    Having a sample project helps us in figuring out the issue and suggesting an appropriate solution accordingly.


    Shashi Ranjan
    Team CanvasJS

    #28683

    https://drive.google.com/open?id=19-ysWDSGRXwmdZv7IHf_ynS5on1nchhJ
    This is a sample. It’s with the Css that I use in my project also. Maybe their is a problem with CSS
    Sample Data is the Data that genarates in the HomeController JSON()

    #28690

    @den_boey,

    Chart properties like data, dataPoint, x, y, etc. are case-sensitive. In the sample project shared above, the key of x and y-values in dataPoints are passed as { X: 10, Y: 10} instead of { x: 10, y: 20 }. Mentioning key(within key-value pair) of JSON in lowercase should work fine in this case. Please take a look at this updated sample.


    Shashi Ranjan
    Team CanvasJS

    #28694

    I want to have give a date and hours and minutes to the graphic. Example. 18/03/2020 18:07

    ———
    DataPoint Class:

    public DataPoint(string label, decimal y)
    {
    this.label = label;
    this.y = y;
    }

    //Explicitly setting the name to be used while serializing to JSON.
    [DataMember(Name = “label”)]
    public string label = “”;

    //[DataMember(Name = “x”)]
    //public Nullable<double> x = null;

    //Explicitly setting the name to be used while serializing to JSON.
    [DataMember(Name = “y”)]
    public Nullable<decimal> y = null;

    ——-

    Is that correct with the label I found it somewhere on the Internet but It doesn’t Work. Maybe you can help me. The thing you said works so thank you for helping me already.

    I want that my x-axis is a string and not a double. Thanks in advance

    #28703

    @den_boey,

    In the code snippet shared above, you are using the label to pass date and time values as string. Instead, you can pass the timestamp of the given date to the x-value. To customize the format of the date and time values on the axis you can use valueFormatString as per your requirement. Please take a look at this gallery example for creating a chart with date and time values in ASP.NET MVC.


    Shashi Ranjan
    Team CanvasJS

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

You must be logged in to reply to this topic.