Murray Brown
asked on
ASP.net Pie chart wording too bunched up
Hi
I am adding the following chart using the code below (ASP.net VB.net). The problem is that the data is too bunched up.
How can I make it more readable? One way would be to have lines linking to a percentage and word outside the chart.
Another way would be to expand the size of the legend and have all the data there. I am not sure how to do either.
Recommendations and code changes around these would be greatly appreciated. Thanks
I am adding the following chart using the code below (ASP.net VB.net). The problem is that the data is too bunched up.
How can I make it more readable? One way would be to have lines linking to a percentage and word outside the chart.
Another way would be to expand the size of the legend and have all the data there. I am not sure how to do either.
Recommendations and code changes around these would be greatly appreciated. Thanks
Sub oChart4(ByVal oChartWidth As Integer, ByVal oChartHeight As Integer, oSQL As String,
ByVal X_Axis_Column As String, ByVal Y_Axis_Column As String, ByVal oAdd_To_Panel As Panel)
' Initialize the Chart object
Dim ChartData As New Chart()
ChartData.BorderSkin.SkinStyle = BorderSkinStyle.Raised
Dim legend1 As New Legend()
' Set the Legend properties
legend1.Name = "Default"
legend1.Docking = Docking.Bottom
legend1.LegendStyle = LegendStyle.Row
legend1.Alignment = System.Drawing.StringAlignment.Center
legend1.BackColor = System.Drawing.Color.Transparent
legend1.BorderColor = System.Drawing.Color.Black
legend1.BorderWidth = 1
' Add the Legend to the Chart
ChartData.Legends.Add(legend1)
' Initialize objects and elements
Dim chartArea1 As New ChartArea()
chartArea1.AxisX.Interval = 1
ChartData.BackColor = System.Drawing.Color.White
ChartData.BorderSkin.SkinStyle = BorderSkinStyle.Raised
'ChartData.BackGradientStyle = GradientStyle.DiagonalRight
chartArea1.AxisX.LabelStyle.ForeColor = System.Drawing.Color.Black
chartArea1.AxisY.LabelStyle.ForeColor = System.Drawing.Color.Black
' Set the ChartArea properties
chartArea1.Name = "Default"
chartArea1.BackColor = System.Drawing.Color.White
chartArea1.BackGradientStyle = GradientStyle.LeftRight
'chartArea1.Area3DStyle.Enable3D = True
' Add the ChartArea to the Chart
ChartData.ChartAreas.Add(chartArea1)
Dim series1 As New Series()
' Set the Series properties
series1.Name = "Series 1"
'series1.ChartType = SeriesChartType.Line
'series1.ChartType = SeriesChartType.Column
series1.ChartType = SeriesChartType.Pie
series1.BorderWidth = 5
'following two lines used to change series line colors....
'series1.EmptyPointStyle.Color = Drawing.Color.Transparent
series1.Color = Drawing.Color.Black
'series1.BorderColor = Drawing.Color.Beige
series1.BackGradientStyle = GradientStyle.LeftRight
'series1.XValueMember = "Date" ' remember that the series is defined in the chart markup
'series1.YValueMembers = "Metres"
series1.XValueMember = X_Axis_Column ' remember that the series is defined in the chart markup
series1.YValueMembers = Y_Axis_Column
series1.BackGradientStyle = GradientStyle.TopBottom
series1.BorderColor = Drawing.Color.DarkBlue
series1.BorderWidth = 1
series1.Label = "#PERCENT{P2}"
series1.LegendText = "#VALX"
'series1("PieLabelStyle") = "Disabled"
ChartData.Width = oChartWidth
ChartData.Height = oChartHeight
'Dim oTitle As String = "Rock Drill Metres v Target"
'ChartData.Titles.Add(New Title(oTitle, Docking.Top, New Font("Century Gothic", 13, FontStyle.Regular), Drawing.Color.White))
' Add the Series to the Chart
ChartData.ChartAreas(0).Area3DStyle.Enable3D = True
ChartData.Series.Add(series1)
Dim cs As String = ConfigurationManager.ConnectionStrings("PSQL").ConnectionString
Dim myConnection As SqlConnection = New SqlConnection(cs)
Dim ds As New DataSet()
Try
Dim adapter As New SqlDataAdapter(oSQL, myConnection)
' Fill the DataSet.
adapter.Fill(ds)
'Me.GridView3.DataSource = ds
'Me.GridView3.DataBind()
ChartData.DataSource = ds
ChartData.DataBind()
oAdd_To_Panel.Controls.Add(ChartData)
Catch ex As Exception
Response.Write(ex.Message & " gg55")
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER