Home forums Using CanvasJS asp.net variable behind code

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  Antrac1t 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18917

    Antrac1t
    Member

    Hi All,
    i would like to ask you if is possible to pass data to chrat from behind code. I tried change on of your example (hart-with-axis-scale-breaks.html). For example part with filling dollars

                    data: [{
                        type: "column",
                        yValueFormatString: "$#,##0.00",
                        dataPoints: [
                            { label: "USA", y: 42494 },
                        ]
                    }]

    i change it to this

                    data: [{
                        type: "column",
                        yValueFormatString: "$#,##0.00",
                        dataPoints: [
                            { label: "USA", y: '<%=dataUSA%>' },
                        ]
                    }]

    and in behind code is

    Public Class yearlytemperature
        Inherits System.Web.UI.Page
        Public dataUSA As Integer
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                dataUSA = "42494"
            End If
            dataUSA = "42494"
        End Sub
    End Class

    but nothing happens, when i will run code in debug mode i can see that variable passed into code but its not rendered :/

    thank you for your help

    BR

    Antra

    #18923

    Indranil Deo
    Member

    @antrac1t,

    The data received using '<%=dataUSA%>' is of type String. Parsing it to int / float should work fine in your case.
    { label: "USA", y: parseFloat('<%=dataUSA%>') },

    ___________
    Indranil Deo,
    Team CanvasJS

    #18925

    Antrac1t
    Member

    Dear Indranil Deo,
    wow your solution working thank you for your help

    BR

    Antra

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

You must be logged in to reply to this topic.