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

Bar Chart - is it possible to have different widths for different bars in the same chart #56

Closed
atreeon opened this issue Nov 10, 2019 · 1 comment

Comments

@atreeon
Copy link

atreeon commented Nov 10, 2019

A chart like below but I would like to make the bar for Algeria really big but keep the others the the size they are now if that is at all possible

Screenshot 2019-11-10 at 18 24 33

@dharanidharandharmasivam
Copy link
Contributor

Hi @atreeon ,

Thanks for your interest in our Syncfusion Flutter chart widget. Yes, your requirement is possible using the override methods. Here we have extended the bar series and using the calculateSegmentPoints we have modified the size of Algeria and Moldva points. This can be changed based on your scenario. Find the code snippet below to achieve this scenario.

class CustomPainter extends BarSegment {
    void calculateSegmentPoints() {
      super.calculateSegmentPoints();
      final double currentHeight = 20;
      if(currentSegmentIndex == 6 || currentSegmentIndex == 1)
         segmentRect = RRect.fromLTRBAndCorners(segmentRect.left, segmentRect.top + 
                 currentHeight, segmentRect.right, segmentRect.bottom -currentHeight);
   }
}

Screenshot:
bar_chart

For your convenience, we have attached the sample which can be found below.
Sample: https://www.syncfusion.com/downloads/support/directtrac/254671/ze/sample-2143631710

Thanks,
Dharani.

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

No branches or pull requests

3 participants