Skip to content

Line Chart - X axis and Y axis Label  #142

Description

@rmaheshkumarblr

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()

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions