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/column gap and overlap not applied to secondary axis #177

Closed
jmcnamara opened this Issue Nov 8, 2014 · 7 comments

Comments

2 participants
@jmcnamara
Owner

jmcnamara commented Nov 8, 2014

If a Y2 axis is used with a gap/overlap in a bar/column chart the value is only applied to the Y1 axis.

@jmcnamara jmcnamara added the bug label Nov 8, 2014

@jmcnamara jmcnamara self-assigned this Nov 8, 2014

jmcnamara added a commit that referenced this issue Nov 9, 2014

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Nov 15, 2014

Owner

Fixed in release 0.6.4.

Owner

jmcnamara commented Nov 15, 2014

Fixed in release 0.6.4.

@jmcnamara jmcnamara closed this Nov 15, 2014

@gglanzani

This comment has been minimized.

Show comment
Hide comment
@gglanzani

gglanzani Nov 17, 2014

I still have problems with column charts. I cannot separate the columns (see screenshot).

The code to generate it is (version 0.6.4)

    rating_chart = workbook.add_chart({'type': 'column'})
    rating_chart.add_series({
        'categories': ['overview', 2, 0, 18, 0],
        'values':     ['overview', 2, 1, 18, 1],
        'name':       'redacted'
    })
    rating_chart.set_x_axis({'name_font':  {'rotation': 90},
                             'num_font':   {'rotation': 90}})
    if product == "SCF":
        rating_chart.add_series({
            'values':     ['overview', 2, 3, 18, 3],
            'name':       'cof',
            'y2_axis':    1,
            'gap':        300
        })
        rating_chart.set_legend({'position': 'right'})
        rating_chart.set_y_axis({'name': 'redacted'})
        rating_chart.set_y2_axis({'name': 'Cof'})

Result is:

screenshot

Edit: I tried to change the overlap for both, but still couldn't separate the columns.

I still have problems with column charts. I cannot separate the columns (see screenshot).

The code to generate it is (version 0.6.4)

    rating_chart = workbook.add_chart({'type': 'column'})
    rating_chart.add_series({
        'categories': ['overview', 2, 0, 18, 0],
        'values':     ['overview', 2, 1, 18, 1],
        'name':       'redacted'
    })
    rating_chart.set_x_axis({'name_font':  {'rotation': 90},
                             'num_font':   {'rotation': 90}})
    if product == "SCF":
        rating_chart.add_series({
            'values':     ['overview', 2, 3, 18, 3],
            'name':       'cof',
            'y2_axis':    1,
            'gap':        300
        })
        rating_chart.set_legend({'position': 'right'})
        rating_chart.set_y_axis({'name': 'redacted'})
        rating_chart.set_y2_axis({'name': 'Cof'})

Result is:

screenshot

Edit: I tried to change the overlap for both, but still couldn't separate the columns.

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Nov 17, 2014

Owner

Hi @gglanzani,

When submitting a bug report it is best to submit a complete working example. See the bug reporting guidelines in Contributing.md.

Here is a complete working example:

import xlsxwriter

print(xlsxwriter.__version__)

workbook = xlsxwriter.Workbook('demo.xlsx')
worksheet = workbook.add_worksheet()
chart = workbook.add_chart({'type': 'column'})

data = [[1, 2, 3, 4, 5],
        [6, 8, 6, 4, 2]]

worksheet.write_column('A1', data[0])
worksheet.write_column('B1', data[1])

chart.add_series({'values': '=Sheet1!$A$1:$A$5',
                  'gap': 51,
                  'overlap': 12})
chart.add_series({'values': '=Sheet1!$B$1:$B$5',
                  'y2_axis': 1,
                  'gap': 251,
                  'overlap': -27})

worksheet.insert_chart('E9', chart)

workbook.close()

And here is the output:

untitled

If you examine the output file in Excel you will see that the gap and overlap are set for both axes:
screen shot 2014-11-17 at 10 46 50

However, in Excel charts the gap is only applied to series on the same axis. It isn't applied to 2 series that are on different axes. You can verify this in Excel.

Regards,

John

Owner

jmcnamara commented Nov 17, 2014

Hi @gglanzani,

When submitting a bug report it is best to submit a complete working example. See the bug reporting guidelines in Contributing.md.

Here is a complete working example:

import xlsxwriter

print(xlsxwriter.__version__)

workbook = xlsxwriter.Workbook('demo.xlsx')
worksheet = workbook.add_worksheet()
chart = workbook.add_chart({'type': 'column'})

data = [[1, 2, 3, 4, 5],
        [6, 8, 6, 4, 2]]

worksheet.write_column('A1', data[0])
worksheet.write_column('B1', data[1])

chart.add_series({'values': '=Sheet1!$A$1:$A$5',
                  'gap': 51,
                  'overlap': 12})
chart.add_series({'values': '=Sheet1!$B$1:$B$5',
                  'y2_axis': 1,
                  'gap': 251,
                  'overlap': -27})

worksheet.insert_chart('E9', chart)

workbook.close()

And here is the output:

untitled

If you examine the output file in Excel you will see that the gap and overlap are set for both axes:
screen shot 2014-11-17 at 10 46 50

However, in Excel charts the gap is only applied to series on the same axis. It isn't applied to 2 series that are on different axes. You can verify this in Excel.

Regards,

John

@gglanzani

This comment has been minimized.

Show comment
Hide comment
@gglanzani

gglanzani Nov 17, 2014

Hi @jmcnamara,

sorry for the bad report.

So what you're saying is that I cannot have non-overlapping columns?

Hi @jmcnamara,

sorry for the bad report.

So what you're saying is that I cannot have non-overlapping columns?

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Nov 17, 2014

Owner

So what you're saying is that I cannot have non-overlapping columns?

I think what I wanted to say was that this may be an Excel limitation. If it isn't and it is some feature that XlsxWriter can or should support then I can add it.

But first you should confirm that what you want to do is actually doable in Excel. I hope that make sense.

Regards,

John

Owner

jmcnamara commented Nov 17, 2014

So what you're saying is that I cannot have non-overlapping columns?

I think what I wanted to say was that this may be an Excel limitation. If it isn't and it is some feature that XlsxWriter can or should support then I can add it.

But first you should confirm that what you want to do is actually doable in Excel. I hope that make sense.

Regards,

John

@gglanzani

This comment has been minimized.

Show comment
Hide comment
@gglanzani

gglanzani Nov 18, 2014

It Turns Out™ that you are right, this is currently not possible with Excel. In order to get something like I envisioned, you have to add an empty column to the plot. Clearly a whacky workaround.

It Turns Out™ that you are right, this is currently not possible with Excel. In order to get something like I envisioned, you have to add an empty column to the plot. Clearly a whacky workaround.

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Nov 18, 2014

Owner

Hi Giovanni,

Thanks to the follow-up to let me know.

John

Owner

jmcnamara commented Nov 18, 2014

Hi Giovanni,

Thanks to the follow-up to let me know.

John

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment