areski / django-nvd3

Django wrapper for nvd3 - It's time for beautiful charts
Other
417 stars 124 forks source link

Custom chart attributes support #20

Closed zebulon2 closed 10 years ago

zebulon2 commented 10 years ago

This is related to (and requires) https://github.com/areski/python-nvd3/pull/24 in python-nvd3.

User can now pass custom chart attributes in extra.

Example: xdata = [0.001, 0.01, 0.1, 1, 10, 100] data = { 'charttype': charttype, 'chartdata': chartdata, 'chartcontainer': chartcontainer, 'extra': { 'x_is_date': False, 'x_axis_format': '', 'tag_script_js': True, 'jquery_on_ready': False, 'chart_attr': { 'xScale':'(d3.scale.log())', 'xAxis.tickValues':xdata }, } }

This allows user to display charts with a log scale on X axis, with the specified tick values.

zebulon2 commented 10 years ago

Just added bug fix 7720d91.

jayme-github commented 10 years ago

:+1:

This is cool as it also allows custom valueFormat definitions like:

'chart_attr': {
     'valueFormat': 'd3.format(",.8f")',
}