Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7663031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:57:09+00:00 2026-05-31T13:57:09+00:00

I am using reportlab to generate simple bar chart. the following is my code.

  • 0

I am using reportlab to generate simple bar chart.
the following is my code.

from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart

d = Drawing(300, 200)
chart = VerticalBarChart()
chart.width = 260
chart.height = 160
chart.x = 30
chart.y = 30
chart.groupSpacing = 10
chart.barWidth = 4
chart.data = [[20.5,0.01],[32.4,0.01]]
chart.categoryAxis.categoryNames = ['foo','bar']

d.add(chart)
d.save(fnRoot='trial',formats=['png',])

enter image description here

both the bars are being displayed under ‘foo’ , while one must be under ‘foo’ and another under ‘bar’ lables.

I tried groupSpacing and barSpacing but could make the bars to come under correct lables.

Can you please tell me how to solve this. I am new to reportlab and hence not able to solve this, also there is very less documentation for reportlab available.

I need to add more labels so how can i do this.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:57:10+00:00Added an answer on May 31, 2026 at 1:57 pm

    There is a misunderstanding here, your chart data come in series like [[20.5,0.01],[32.4,0.01]] so you first group has two bars of values 20.5 and 32.4, your second group has another two bars of values 0.01 and 0.01. The values on the second series are so small that you cannot see their bars.
    If your desire was to display the 32.4 bar in the first group and the 20.5 in the second group then you could change your data into

    chart.data = [(20.5,32.4),(0.01, 0.01)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I´m using Reportlab to generate a PDF. Can´t retrieve a photo from a model.
I am using reportlab to generate a LinePlot chart. I can't seem to get
I am using reportlab to generate a pdf report automatically from dynamic data. As
I'm generating a bar chart using ReportLab VerticalBarChart. I need one of the bars
I'm using Reportlab to generate report cards. The report cards are basically one big
I’m using django and reportlab tool generate Dynamic PDF reports. All the data in
I need to generate the form seen here using Python/reportlab. http://www.flickr.com/photos/49740282@N06/4563137758/sizes/o/ I am attempting
I'm using ReportLab to print a chart produced by matplotlib. I'm able to do
I'm writing a python script to generate PDF using ReportLab. So whenever i made
Question : I'm generating charts using ReportLab. Charts are generated properly but into different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.