0

I'm in need of help please, I'm using MSChart for .NET4.0 WinForms in C Sharp and right now when I plot my chart the annotations are all over the place.

Callouts are all over the place! it's really messy!

What I really like is for this (I manually moved the Callouts after to make this screenshot)

Manually positioned Callout with mouse after chart render

So what I am wondering, is there a way I can make sure that ALL Callout annotations stay absolutely on top of bottom vertically of the respective datapoint anchor? I don't wish for the Callouts to move left or right....

Thanks everyone...

DeveloperDavid
  • 157
  • 2
  • 7
  • 16

1 Answers1

0

MSChart uses SmartLabel Technology to display labels.

You can change this property

Chart1.Series["Series1"].SmartLabels.MovingDirection =  
LabelAlignment.Bottom | LabelAlignment.Top; 

You can check these links

http://www.codeproject.com/Articles/24644/What-can-SmartLabels-Technology-do-for-me http://support2.dundas.com/OnlineDocumentation/WebChart2005/UsingSmartLabels.html http://msdn.microsoft.com/en-us/library/system.web.ui.datavisualization.charting.smartlabelstyle.aspx

Quantbuff
  • 827
  • 7
  • 9
  • Hi, thanks for this, I did see this, however 1 thing, I don't have SmartLabels property, only SmartLabelStyle & LabelAlignmentStyle properties which I've tried but doesn't seem to make any differences. Maybe because I have many series in the Chart, there maybe a default setting that I must override somewhere? Any pointers of usual hick-ups would be helpful as I believe I have checked everywhere now without avail... thanks – DeveloperDavid Jun 25 '12 at 21:35
  • Try this property and check if it works http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.annotationsmartlabelstyle.aspx – Quantbuff Jun 25 '12 at 21:48
  • Thanks for the MSDN link, after reading that I believe I am doing everything right with SmartLabelStyle :D it's just not working for me yet :( are there any common pitfalls I should be aware of that I might have stuck my feet on? – DeveloperDavid Jun 25 '12 at 21:58
  • I think I've worked it out, after cleaning up the code, maybe because I am using a live datafeed and I am dynamically creating annotation objects to dynamically add to the chart, I cleared all annotation chart properties and only declared them each time I create a new instance of an annotation to add to the referred Chart. The only property I could not find when instantiating a new annotation was Chart1...SmartLabelStyle.IsOverlappedHidden = false; so I set this for each Chart area I have. My chart is still not perfect but it's much better now, thanks Quantbuff :D – DeveloperDavid Jun 25 '12 at 22:31