microcharts-dotnet / Microcharts

Create cross-platform (Xamarin, Windows, ...) simple charts.
MIT License
2.02k stars 361 forks source link

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

Open foysolshuvo opened 3 years ago

foysolshuvo commented 3 years ago

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
Seuleuzeuh commented 3 years ago

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

foysolshuvo commented 3 years ago

@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.

Seuleuzeuh commented 3 years ago

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

twofingerrightclick commented 2 years ago

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.