|
-
Apr 3rd, 2013, 07:41 AM
#1
Thread Starter
Member
Formatting the chart control
Hey,
The chart control is doing whatever it likes, and I'm looking for a way to control how it outputs axes values and how to set a specific scale. This is my current problem.
The scale on the X axis is decreasing, by default.
I also would like to limit the labels to 1 decimal place.

Cheers
-
Apr 3rd, 2013, 10:54 AM
#2
-
Apr 10th, 2013, 05:15 AM
#3
Thread Starter
Member
Re: Formatting the chart control
Thanks for your detailed and helpful reply, and I'm sorry for my extremely late one. For some reason it doesn't seem to be as simple a fix as above, the Y axis obeys:
Code:
Chart1.ChartAreas(0).AxisY.LabelStyle.Format = "N1"
However for the X axis it is ineffective.I don't think it is being overwritten at another point, because this is all the code I have relating to the chart:
Code:
Dim series_1 As New Series
series_1.ChartType = SeriesChartType.Spline
series_1.XValueMember = ("X values")
series_1.YValueMembers = ("Y values")
Chart1.Series.Add(series_1)
Chart1.DataSource = ARpassover_table
Chart1.ChartAreas(0).AxisX.LabelStyle.Format = "N1"
Also, changing the interval values didn't help with the scale either, it just removed the intervals in most cases, the shape of the graph never changed. I think it is because the data is bottom heavy, there are more values in the 2nd half of the data than the first. I think the chart is trying to compensate by making the intervals smaller by default, but whenever I change the intervals it just removes them. Any more ideas?
-
Apr 10th, 2013, 05:59 AM
#4
Thread Starter
Member
Re: Formatting the chart control
With this code :
Code:
With Chart1.ChartAreas(0)
.AxisX.Minimum = 0
.AxisX.Maximum = 32
.AxisY.Minimum = 0
.AxisY.Maximum = 40
' .AxisX.Interval = 1
.AxisX.Title = "X-Distance (m)"
.AxisY.Title = "Y-Distance (m)"
.AxisY.LabelStyle.Format = "N1"
.AxisX.LabelStyle.Format = "N1"
End With
it returns this :

Now why does it make the Y axis go up to 40, whilst limiting the X axis to 32 points of data! I thought it would make both go to the specified value. Is there some major difference in the way it handles X and Y axis formatting?
-
Apr 10th, 2013, 08:34 AM
#5
Thread Starter
Member
Re: Formatting the chart control
Progress! - Looping through to add the data allows me to show you how it should look, anyone know of a way to still have it bound to a datatable and recreate these results?
-
Apr 10th, 2013, 09:02 AM
#6
Thread Starter
Member
Re: Formatting the chart control
Using
Code:
For Each row As DataRow In ARpassover_table.Rows
Chart1.Series(0).Points.AddXY(row.Item(0), row.Item(1))
Next row
puts me back at square one. And yes, I am talking to myself, it helps :P
Is there a way to disable the automatic stuff when databinding stuff to charts?
-
Apr 21st, 2013, 03:22 PM
#7
Hyperactive Member
Re: Formatting the chart control
My question is how can I format a bar chart. The color of the bar is blue. Can I use a different color for each bar? How?

Last edited by Jose_VB; Apr 21st, 2013 at 03:28 PM.
-
Apr 21st, 2013, 05:48 PM
#8
Thread Starter
Member
Re: Formatting the chart control
I think that's just the default image for charts, but you should really create a new thread for this, good luck.
-
Apr 22nd, 2013, 01:09 AM
#9
Hyperactive Member
Re: Formatting the chart control
I will use this thread. If no one answers then I will open a new one.
-
Apr 22nd, 2013, 01:31 AM
#10
Hyperactive Member
Re: Formatting the chart control
I've found in other forum that answers:
Chart1.Series(0).Points(1).Color = Color.Beige
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|