Quantcast
Viewing all articles
Browse latest Browse all 15634

VS 2019 How to Visualize legend for each Chart Area

Hi all,
I developed a Function that creates a Chart Area inside a chart.
I tried to assign to each Chart Area a legend without success.

A part of this Function is:

Code:

Private Sub _CreateStackedDrawKPI(ByVal MyChart As Chart, ByVal T As DataTable, ByVal titolo As String, ByVal NumChartArea As Integer, ByVal legenda As String)
 
x = (From p In T.AsEnumerable()
            Select p.Field(Of String)("Week") Distinct).ToArray()
        ' Order By p.Field(Of String)("Week")


        y1K = (From p In T.AsEnumerable()
              Select p.Field(Of Integer)("Num_CS_RAB_Est_Att")).ToArray()


        y2K = (From p In T.AsEnumerable()
              Select p.Field(Of Integer)("Num_CS_RAB_Est_Succ")).ToArray()

        y3 = (From p In T.AsEnumerable()
              Select p.Field(Of Double)("CSSR")).ToArray()

        Dim ChartArea1 = New ChartArea()

        ChartArea1.Name = titolo
        MyChart.ChartAreas.Add(titolo)
        Dim Mylegend As New Legend
        Mylegend.Name = legenda
        MyChart.Legends.Add(legenda)
        MyChart.Legends(legenda).DockedToChartArea = titolo
        MyChart.Legends(titolo).IsDockedInsideChartArea = False
...

This function is called in this way:
Code:

Dim aa As New MyFunctions
                ....
                If Lista_KPI.Count = 1 Then
                ChartKPI = New Chart
                ChartKPI.Name = "Chart_KPI"
                SplitContainer3.Panel2.Controls.Add(ChartKPI)
                aa.CreateStackedDrawKPI(ChartKPI, T_Data1, NomeContatore, Lista_KPI.Count, Titolo)
            End If


            If Lista_KPI.Count = 2 Then
                aa.CreateStackedDrawKPI(ChartKPI, T_Data1, NomeContatore, Lista_KPI.Count, Titolo)
            End If

Lista_KPI is a list of string of 2 elements: CSSR and DCR
NomeContatore is a string and it is equal at first step to value "CSSR" and in second Step to "DCR"
Titolo is a string and it is equal at first step to value "CSSR" and in second Step to "DCR".
Titolo is equal to NomeContatore
Each Element of list calls the function above.

Issue s that both legend and also Title are showed always in first Chart Area

Image may be NSFW.
Clik here to view.
Name:  image.jpg
Views: 3
Size:  20.8 KB


Any suggestion?
Thank in advanced
gio
Attached Images
Image may be NSFW.
Clik here to view.
 

Viewing all articles
Browse latest Browse all 15634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>