Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max value of chart #24

Closed
GyllionElderen opened this issue Oct 11, 2017 · 11 comments
Closed

Max value of chart #24

GyllionElderen opened this issue Oct 11, 2017 · 11 comments
Labels

Comments

@GyllionElderen
Copy link

Hello there, I'm using Microchart for Xamarin.Forms. Great tool so far! However, I found an interesting bug:

microchart_maxvalue_bug

According to the tutorial, the max value will become the value of the chart with the highest value. In my case, the max value of the chart is that divided by 2. If I increase the 'MaxValue' property to 400, it still does not give me the desired max value.

Is this a known bug? Am I doing something wrong in my code? Please let me know. I'm using 0.8.1-pre.

@aloisdeniel
Copy link
Collaborator

aloisdeniel commented Oct 11, 2017

Could you provide your chart initialization code? Not sure to understand your case...

If you define chart.MaxValue = 400, then your February column should be filled. Now if you define chart.MaxValue = 800, then your February column should be half filled (like on your screenshot) and so on.

And by default the MaxValue is the maximum of all your entry values (here 400).

@GyllionElderen
Copy link
Author

Even if I put the MaxValue to 400, still no result. This is the code I was using:

return new BarChart
{
    Entries = new List<Entry>
     {
         new Entry(200)
         {
            Label = "January",
            ValueLabel = "200",
            Color = SKColor.Parse("#266489")
         },
         new Entry(400)
         {
             Label = "February",
             ValueLabel = "400",
             Color = SKColor.Parse("#68B9C0")
         },
         new Entry(100)
         {
             Label = "March",
             ValueLabel = "-100",
             Color = SKColor.Parse("#90D585")
         }
     },
     LabelTextSize = 30,
     BarAreaAlpha = 255,
     MaxValue = 400
 };

@aloisdeniel
Copy link
Collaborator

Okay, spotted the error.

I apologize, I'll publish an update very soon. :(

@GyllionElderen
Copy link
Author

Okay, I found out what the problem was. The animation was not working properly. For a temporary fix, try this:

BarChart barChart = new BarChart{ IsAnimated = false };

@aloisdeniel
Copy link
Collaborator

Sad that you can't use animation.

I just published a new pre-release which include a fix related to MaxValue.

Is it better now?

@GyllionElderen
Copy link
Author

I installed the new pre-release and the problem is still there. I figured that the animation cannot play. When loading is done, it shows only the current frame as following:

capture

Do I need to enable something in my project in order to make the animation play?

@Calvin-2DWeb
Copy link

Some news about the maxVlaue? i'm trying to use it with Donut, to show something like:
maxValue = 100%, achieved= 80%, so the graphic fill just 80% of the donut.

@aloisdeniel
Copy link
Collaborator

aloisdeniel commented Nov 10, 2017

Hum, the use of RadialGaugeChart is more appropriate in this case for me.

Setting a max value to a donut doesn't make sense to me, imagine your have 2 portions with 60 and 50and a max value of 100 ? Do we have to cut the last portion ?

@Calvin-2DWeb
Copy link

that's right, I was trying to use the wrong chart. and if I need to use in Donut form, I just need to use two portions one with the rest of the other, (100% = 1 portion of 80 and other of 20) this will made the chart I need. Thanks!
And a tip: Microcharts is awesome, but maybe it need more documentation, like what attributes and functions each chart have and so on... (if there is a documentation for that, I apologize, because I didn't find)

@Calvin-2DWeb
Copy link

Also, there is a Way to show in the chart the MaxValue as a Label or something?

@Nixon-Joseph
Copy link
Contributor

Closing due to inactivity and apparent resolution. @CalvinNunes if you wish to know about the maxValue label as an option, please start a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants