Public Class SingleBarHorizontalReceitaGraphBlack
    Inherits System.Web.UI.Page

    Public Property Titutlo As String

    Public Property TheData As String

    Public Property Column1 As String = "'string', 'element'"
    Public Property Column2 As String = "'number', 'EUR'"

    Public Property cores As String

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim sessionID = Request.QueryString("ID_Graf")

        If Not DashboardContabilidade.SessionH.GrafSession.ContainsKey(sessionID) Then Exit Sub

        Dim session = DashboardContabilidade.SessionH.GrafSession(sessionID)

        Titutlo = session.Titutlo

        cores = session.Cores

        BuildSingle(session)
    End Sub

    Private Sub BuildSingle(g As DashboardContabilidade.GraphCashe)
        Dim fullObjList = New List(Of String)

        For Each d In g.DataSource
            Column1 = "'string', '" & d.DicValues.First.Key & "'"

            fullObjList.Add("['" & d.SerieName & "'," & Math.Round(d.DicValues.First.Value, 2, MidpointRounding.AwayFromZero).ToString.Replace(",", ".") & "]")
        Next

        TheData = "[" & String.Join(",", fullObjList) & "]"
    End Sub

End Class