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

  • SEARCH
  • Home
  • 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 8249877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:41:35+00:00 2026-06-07T23:41:35+00:00

I’m trying to generate a pie chart using axlsx for ruby. Everything is working

  • 0

I’m trying to generate a pie chart using axlsx for ruby. Everything is working fine but I can’t seem to get data labels to appear for each “pie slice”. What I’m shooting for is more or less like this image. (ie it should have the data labels and leader lines). It would also be fine to have the labels just have the numerical value and include a legend with the color mapping as usual.

Anyone know how to 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-06-07T23:41:37+00:00Added an answer on June 7, 2026 at 11:41 pm

    This is randym, the author of axlsx.
    The short version is that this has not been implemented yet, so you are not going to be able to get labels into the chart as per your image.

    The biggest missing piece from the spec is (ECMA-376 – Part 1)

    21.2.2.49 dLbls (Data Labels)

    Which needs to be plugged into either series, chart, or both as it appears to be a common element of all three.

    I will have sometime later this week to have a deeper look, but if you are up for contributing to axlsx – grab me on freenode (#axlsx) or post an issue to the repo https://github.com/randym/axlsx

    UPDATE

    Turns out this was much easier than I anticipated.

    There is now a working version on master (https://github.com/randym/axlsx) for pie charts.
    I’ll update the rest of the supported chart types over the next few days and shoot for an official release next week.

    Thanks for letting me know that you needed this.

    Here is a simple example of how to use it:

    require 'axlsx'
    p = Axlsx::Package.new
    wb = p.workbook
    
    # Pie Chart
    wb.add_worksheet(:name => "Pie Chart") do |sheet|
      sheet.add_row ["First", "Second", "Third", "Fourth"]
      sheet.add_row [1, 2, 3, 4]
      sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title=> 'dark corner here') do |chart|
        chart.add_series :data => sheet["A2:D2"], :labels => sheet["A1:D1"]
        chart.d_lbls.show_val = true
        chart.d_lbls.show_percent = true
        chart.d_lbls.d_lbl_pos = :outEnd
        chart.d_lbls.show_leader_lines = true
      end
    end
    
    p.serialize 'pie_chart_with_data_labels.xlsx'
    

    Available attributes for d_lbls are:

    lbl_pos Must be one of :bestFit, :b, :ctr, :inBase, :inEnd, :l, :outEnd, :r, :t
    By default axlsx will use :bestFit

    and the following boolean attributes:

    show_legend_key

    show_val

    show_cat_name

    show_ser_name

    show_percent

    show_bubble_size

    show_leader_lines

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.