Private Shared Function GetData(query As String) As DataTableĭim constr As = ConfigurationManager.ConnectionStrings("ConString"). VB.Net Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Loadĭim query As String = String.Format("select TOP 20 shipcity, count(orderid) from orders group by shipcity")ĭim x As String() = New String(dt.Rows.Count - 1) įor i As Integer = 0 To dt.Rows.Count - 1Ĭhart1.Series(0).ChartType = SeriesChartType.PieĬhart1.ChartAreas("ChartArea1").Area3DStyle.Enable3D = False SqlDataAdapter sda = new SqlDataAdapter() SqlConnection con = new SqlConnection(constr) The number of things I've tried which haven't worked is now fairly surprising, including TM leader lines, which is very old an may have issues with the latest version of Excel. I've got the same problem, trying to include a 5 digit label on a scatter graph of 140 points.
You can decide how to resolve the overlapping by choosing one of the overlapping behavior modes. Private static DataTable GetData(string query) Re: Scatter Graph - Overlapping Data Labels. In this demo, argument axis labels overlap due to their length. String query = string.Format("select TOP 20 shipcity, count(orderid) from orders group by shipcity") Ĭ(x, y) Ĭ = SeriesChartType.Pie Ĭ3D = false
Is there a way to do this via VBA I know how to update the chart axis via vba linked to cell values, but I cant figure out a formula I can use to calculate the minimum which takes into account the distance needed to avoid the overlapping problem. Imports .DataVisualization.ChartingĬ# protected void Page_Load(object sender, EventArgs e) I want to avoid the Data Labels (for the negative values) overlapping the x axis. which ensures that labels avoid overlapping and are displayed clearly. Now please take its reference and correct your code. Text can be in the form of chart captions, subcaptions, axis titles, data values. Using the above article i have created example. Check this example. Figure 7 Edit vertical axis labels in Excel. In the drop-down menu, we will click on Axis Titles, and subsequently, select Primary vertical. We will go to Chart Design and select Add Chart Element. Populate ASP.Net 4.0 Chart Control Pie Chart from SQL Server Database We will again click on the chart to turn on the Chart Design tab. Add a Legend and show the names in Legend. This is the only option which you can display it in nice way.