Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Values truncated for small values in bar chart control (Read 3012 times)
abhi dhotre
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 28
Joined: Jul 12th, 2017
Values truncated for small values in bar chart control
Sep 5th, 2017 at 7:33pm
Print Post  
Hi,
I'm using a stacked bar chart and want to display all the values of bars(any data labels i.e.inner or outer). In the attached picture you can see that the values are truncated because of the small values of bars on the right. Currently, I'm using inner but evn if I use outerdatalabels the values are truncated. Is there any way to display the values?
  

Capture_003.PNG ( 9 KB | 217 Downloads )
Capture_003.PNG
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Values truncated for small values in bar chart control
Reply #1 - Sep 6th, 2017 at 9:08am
Print Post  
Hi,

You could add label texts as annotations when you detect small values. We'll try to implement built-in label to annotation conversion for next release.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
abhi dhotre
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 28
Joined: Jul 12th, 2017
Re: Values truncated for small values in bar chart control
Reply #2 - Sep 21st, 2017 at 6:24pm
Print Post  
Can you share a sample source code for doing above change? I'm unaware of working with annotations.

Thanks,
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Values truncated for small values in bar chart control
Reply #3 - Sep 22nd, 2017 at 10:25am
Print Post  
Added to the barchart code you posted in earlier thread -

Code
Select All
...
new DataObject { MonthCount = 2, TheMonth = "Mar", A = 300, B = 10 },
...
var labels = new List<string>();
var values = new List<double>();
foreach (var dataItem in dt)
{
	if (dataItem.B < 20)
	{
		labels.Add(dataItem.B.ToString());
		values.Add(dataItem.A + dataItem.B); // bring it to stack's height
	}
	else
	{
		labels.Add("");
		values.Add(0);
	}
}
barChart1.Annotations = new ObservableCollection<Series> { new SimpleSeries(values, labels) }; 



This will show annotation rectangles with full text where bar values are smaller than 20. You'd probably want to change the 20 threshold with a calculated value that depends on your chart's max Y range.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint