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

Setting line properties of chart axes #88

Closed
AAchey opened this issue Jan 8, 2014 · 6 comments
Closed

Setting line properties of chart axes #88

AAchey opened this issue Jan 8, 2014 · 6 comments
Assignees

Comments

@AAchey
Copy link

@AAchey AAchey commented Jan 8, 2014

I'm not sure if I'm missing anything, but I can't figure our how to set the line properties of the axis of a chart. For example, using the code below I can create the chart perfectly.

What I'm TRYING to do is sort of indicated by the 'line' property I set in the ax_dict even though set_x_axis ignores it (as it should since there's nothing indicating it would support that). In the generated excel sheet I could then use "format axis..." -> "line style" to set thickness/color and get the effect I want.

import xlsxwriter 
import os

#create book and sheet
workbook = xlsxwriter.Workbook('test1.xlsx')   
worksheet = workbook.add_worksheet('testsheet')  

#some test data
worksheet.write_row('A1',[-0.5,-0.5])      
worksheet.write_row('A2',[0.5,0.5])

#create the chart
chart = workbook.add_chart({'type': 'scatter',
                            'subtype': 'straight_with_markers',
                            'major_gridlines': {'visible': True}
                            })       

#add the data points
chart.add_series({
    'name': 'testdata',
    'categories': 'testsheet!A1:A5',
    'values':     'testsheet!B1:B5',
    'marker':   {'type': 'square'}
})                    

#both axes the same...
ax_dict={'min': -1,
        'max': 1,
        'major_unit': .2,
        'minor_gridlines': {'visible': False},
        'major_gridlines': {'visible': True, 'line': {'width': 0.5}},
        'num_font':  {'size': 6 },
        'label_position': 'low',
        'line': {'width': 2.0}
        }            

chart.set_x_axis(ax_dict)
chart.set_y_axis(ax_dict)    

worksheet.insert_chart('C3', chart)
workbook.close() 
@jmcnamara
Copy link
Owner

@jmcnamara jmcnamara commented Jan 8, 2014

That isn't currently possible. I've added it as a feature request.

@AAchey
Copy link
Author

@AAchey AAchey commented Jan 8, 2014

Thank you, and apologies for the duplicate of #87. I attempted to post that once just as github had a hiccup.

@jmcnamara
Copy link
Owner

@jmcnamara jmcnamara commented Jan 9, 2014

No problem. I saw that it was down earlier.

You will get a notification when I post a fix for this issue.

@parkermalenke
Copy link

@parkermalenke parkermalenke commented Aug 20, 2014

+1 for this feature. The ability to remove the line and ticks (both or either) for an axis would be nice as well.

Thanks for your work on this module, it's been a great help in my project.

@jmcnamara
Copy link
Owner

@jmcnamara jmcnamara commented Aug 21, 2014

@parkermalenke

+1 for this feature. The ability to remove the line and ticks (both or either) for an axis would be nice as well.

Noted.

jmcnamara added a commit that referenced this issue Nov 1, 2014
Issue #88.
@jmcnamara
Copy link
Owner

@jmcnamara jmcnamara commented Nov 1, 2014

Added in version 0.6.2 which is now on PyPI.

Thanks for the suggestion.

@jmcnamara jmcnamara closed this Nov 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.