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

Line Chart - X axis and Y axis Label #142

Open
rmaheshkumarblr opened this issue Jun 29, 2017 · 1 comment
Open

Line Chart - X axis and Y axis Label #142

rmaheshkumarblr opened this issue Jun 29, 2017 · 1 comment

Comments

@rmaheshkumarblr
Copy link

Creating a Line Chart and then adding axis throws error.

from nvd3 import lineChart
output_file = open('LineChart.html','w')
chart = lineChart(name="lineChart", x_is_date=False, x_axis_format="AM_PM", show_labels=True, margin_bottom=60, margin_top=60)
xdata = range(24)
ydata = [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 4, 3, 3, 5, 7, 5, 3, 16, 6, 9, 15, 4, 12]
ydata2 = [9, 8, 11, 8, 3, 7, 10, 8, 6, 6, 9, 6, 5, 4, 3, 10, 0, 6, 3, 1, 0, 0, 0, 1]
extra_serie = {"tooltip": {"y_start": "There are ", "y_end": " calls"}}
kwargs1 = {'color': "blue"}
kwargs2 = {'color': 'red'}
chart.add_serie(y=ydata, x=xdata, name='sine', extra=extra_serie, **kwargs1)
extra_serie = {"tooltip": {"y_start": "", "y_end": " min"}}
chart.add_serie(y=ydata2, x=xdata, name='cose', extra=extra_serie, **kwargs2)
chart.create_x_axis(name="Xaxis", label="Something in X-axis")
chart.create_y_axis(name="Yaxis", label="Something in Y-axis")

chart.buildhtml()
output_file.write(chart.htmlcontent)
output_file.close()

@rmaheshkumarblr
Copy link
Author

Workaround right now:

Before writing: chart.htmlcontent.replace("Ya","yA").replace("Xa","xA")
NVD3.js expectes yA instead of Ya for "chart.yAxis.axisLabel". Same is the case with X axis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant