Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic X Labels goes on top of each other when zooming in (Read 3889 times)
znavot
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 18
Joined: Dec 31st, 2013
X Labels goes on top of each other when zooming in
Jan 23rd, 2014 at 2:28pm
Print Post  
Hi,

I'm using a line chart which supports zoom behavior.
The X-axis of the graph contains dates which are displayed as auto-scaled labels.
I wish to display only 5 labels on the X axis which will not overlap.
In normal mode, the graph looks ok (see attached NormalView.png file).
But when I zoom in, suddenly 10 labels are being generated and goes on top of each other, creating some mess (See attached ZoomIn.png file).
How can I keep the original layout of the labels (5 auto-scaled) when zooming in ?

Thanks,
Nir


Code
Select All
this.lineChart.XAxisSettings.StartDateTime = getMinDate(_xDataFieldName);
this.lineChart.XAxisSettings.EndDateTime = getMaxDate(_xDataFieldName);
TimeSpan span = this.lineChart.XAxisSettings.EndDateTime - this.lineChart.XAxisSettings.StartDateTime;
TimeSpan quarter = new TimeSpan(span.Ticks / 4);
this.lineChart.XAxisSettings.TimeSpan = quarter;
this.lineChart.XAxisSettings.LabelType = MindFusion.Charting.AxisLabelType.AutoScale;
 




  

NormalView.png (Attachment deleted)
ZoomIn.png (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: X Labels goes on top of each other when zooming in
Reply #1 - Jan 23rd, 2014 at 8:34pm
Print Post  
Hi,

Click the 'you have messages' link at top of the forum to open the PM page. There you can find updated build of the control that adds ZoomChanged event. You can handle it like this to keep a constant number of labels, e.g. 4:

Code
Select All
private void lineChart1_ZoomChanged(object sender, EventArgs e)
{
    DateTime dt1 = lineChart1.XAxisSettings.StartDateTime;
    DateTime dt2 = lineChart1.XAxisSettings.EndDateTime;

    TimeSpan q = dt2 - dt1;
    TimeSpan quarter = new TimeSpan(q.Ticks / 4);
    lineChart1.XAxisSettings.TimeSpan = quarter;
    lineChart1.UpdateChart();
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
znavot
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 18
Joined: Dec 31st, 2013
Re: X Labels goes on top of each other when zooming in
Reply #2 - Jan 26th, 2014 at 6:58am
Print Post  
It works.

Thank you very much,
Nir
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint