Microcharts icon indicating copy to clipboard operation
Microcharts copied to clipboard

[Bug] Show bar height with colour when entry value is zero

Open foysolshuvo opened this issue 3 years ago • 4 comments

Description When a BarChart entries values are zero, the bars show up with a height. That's confusing.

Which platform and version is this for? MacOS Catalina 10.15 Xamarin.Mac

To Reproduce Here is my simple chart entries:

var entries = new[]
{
	new ChartEntry(0)
	{
		Color = SKColor.Parse("#8CDAB2"),
	},
	new ChartEntry(0)
	{
		Color = SKColor.Parse("#FF8B78"),
	},
	new ChartEntry(1)
	{
		Color = SKColor.Parse("#FFDF8A"),
	},
	new ChartEntry(0)
	{
		Color = SKColor.Parse("#8CDAB2"),
	},
	new ChartEntry(2)
	{
		Color = SKColor.Parse("#FF8B78"),
	},
};

Expected behavior The bars should be empty when the entry value is zero.

Screenshots Current barChart behaviour for the above entires. Screenshot 2021-05-28 at 8 18 38 PM

foysolshuvo avatar May 28 '21 14:05 foysolshuvo

You have a property MinBarHeight on the Bar chart, you can set it to 0, to match your need

Seuleuzeuh avatar May 30 '21 09:05 Seuleuzeuh

@Seuleuzeuh, I couldn't find any property namely MinBarHeight in the BarChart. However, I found a property named MinValue, I tried to set this value as zero. It couldn't fix our problem, the result is the same as before.

foysolshuvo avatar Sep 15 '21 10:09 foysolshuvo

What version of Microchart do you have ? This property is available in the latest preview package (but undocumented).

Seuleuzeuh avatar Sep 15 '21 10:09 Seuleuzeuh

Yes by default there will always be a bar drawn of some default size for entries with values of 0. It wasn't until 1.0.0-preview1 that there is an option to set the MinBarHeight for entries with the value 0.

twofingerrightclick avatar Jul 19 '22 18:07 twofingerrightclick