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

Replace type by chartname #176

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ bower_components

archive
env
myenv

htmlcov
test_*.html
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ These graphs can be part of your web application:
Want to try it yourself? Install python-nvd3, enter your python shell and try this quick demo::

>>> from nvd3 import pieChart
>>> type = 'pieChart'
>>> chart = pieChart(name=type, color_category='category20c', height=450, width=450)
>>> chart_name = 'pieChart'
>>> chart = pieChart(name=chart_name, color_category='category20c', height=450, width=450)
>>> xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
>>> ydata = [3, 4, 0, 1, 5, 7, 3]
>>> extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}}
Expand Down
4 changes: 2 additions & 2 deletions docs/source/includes/introduction.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ After installation use python-nvd3 as follows ::
# Open File to write the D3 Graph
output_file = open('test-nvd3.html', 'w')

type = 'pieChart'
chart = pieChart(name=type, color_category='category20c', height=450, width=450)
chart_name = 'pieChart'
chart = pieChart(name=chart_name, color_category='category20c', height=450, width=450)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ These graphs can be part of your web application:
Want to try it yourself? Install python-nvd3, enter your python shell and try this quick demo::

>>> from nvd3 import pieChart
>>> type = 'pieChart'
>>> chart = pieChart(name=type, color_category='category20c', height=450, width=450)
>>> chart_name = 'pieChart'
>>> chart = pieChart(name=chart_name, color_category='category20c', height=450, width=450)
>>> xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
>>> ydata = [3, 4, 0, 1, 5, 7, 3]
>>> extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}}
Expand Down
4 changes: 2 additions & 2 deletions examples/cumulativeLineChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# Open File for test
output_file = open('test_cumulativeLineChart.html', 'w')

type = "cumulativeLineChart"
chart = cumulativeLineChart(name=type, height=350, x_is_date=True)
chart_name = "cumulativeLineChart"
chart = cumulativeLineChart(name=chart_name, height=350, x_is_date=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

xdata = list(range(nb_element))
Expand Down
32 changes: 16 additions & 16 deletions examples/demo_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

output_file.write(html_open)

type = "discreteBarChart"
chart_name = "discreteBarChart"
chart = discreteBarChart(name='my graphname', height=400, width=800, jquery_on_ready=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
xdata = ["A", "B", "C", "D", "E", "F", "G"]
Expand All @@ -58,8 +58,8 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "pie Chart"
chart = pieChart(name=type, color_category='category20c', height=400,
chart_name = "pie Chart"
chart = pieChart(name=chart_name, color_category='category20c', height=400,
width=400, jquery_on_ready=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

Expand All @@ -74,7 +74,7 @@
# ---------------------------------------

name = "lineChart-different-x-axis"
type = "lineChart"
chart_name = "lineChart"
chart = lineChart(name=name, height=400, width=800, x_is_date=False,
jquery_on_ready=True)

Expand All @@ -98,7 +98,7 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "lineChart"
chart_name = "lineChart"
chart = lineChart(height=400, width=800, x_is_date=True, x_axis_format="%d %b %Y %H",
jquery_on_ready=True)

Expand All @@ -123,7 +123,7 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "lineChartWithInteractiveGuideline"
chart_name = "lineChartWithInteractiveGuideline"
chart = lineChart(name="lineChart-With-Interactive-Guideline",
height=400, width=800, x_is_date=True, x_axis_format="%d %b %Y %H",
jquery_on_ready=True, use_interactive_guideline=True)
Expand All @@ -149,7 +149,7 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "lineWithFocusChart"
chart_name = "lineWithFocusChart"
chart = lineWithFocusChart(color_category='category20b', x_is_date=True,
height=400, width=800,
x_axis_format="%d %b %Y", jquery_on_ready=True)
Expand Down Expand Up @@ -177,7 +177,7 @@

# ---------------------------------------

type = "stackedAreaChart"
chart_name = "stackedAreaChart"
chart = stackedAreaChart(height=400, width=800, x_is_date=True,
x_axis_format="%d %b %Y %I", jquery_on_ready=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
Expand All @@ -197,7 +197,7 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "linePlusBarChart"
chart_name = "linePlusBarChart"
chart = linePlusBarChart(height=400, width=800, x_is_date=True,
x_axis_format="%d %b %Y", jquery_on_ready=True,
focus_enable=True)
Expand All @@ -219,7 +219,7 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "cumulativeLineChart"
chart_name = "cumulativeLineChart"
chart = cumulativeLineChart(height=400, width=800,
x_is_date=True, x_axis_format="%d %b %Y",
jquery_on_ready=True)
Expand All @@ -240,7 +240,7 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "multiBarHorizontalChart"
chart_name = "multiBarHorizontalChart"
chart = multiBarHorizontalChart(height=400, width=800, jquery_on_ready=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

Expand All @@ -258,7 +258,7 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "multiBarChart"
chart_name = "multiBarChart"
chart = multiBarChart(height=400, width=800, jquery_on_ready=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
nb_element = 10
Expand All @@ -275,8 +275,8 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "multiBarChartDate"
chart = multiBarChart(name=type, height=400, width=800, x_is_date=True, jquery_on_ready=True)
chart_name = "multiBarChartDate"
chart = multiBarChart(name=chart_name, height=400, width=800, x_is_date=True, jquery_on_ready=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
nb_element = 100
start_time = int(time.mktime(datetime.datetime(2012, 6, 1).timetuple()) * 1000)
Expand All @@ -297,8 +297,8 @@
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "scatterChart"
chart = scatterChart(name=type, height=350, width=800, x_is_date=False)
chart_name = "scatterChart"
chart = scatterChart(name=chart_name, height=350, width=800, x_is_date=False)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
nb_element = 50
xdata = [i + random.randint(1, 10) for i in range(nb_element)]
Expand Down
4 changes: 2 additions & 2 deletions examples/discreteBarChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Open File for test
output_file = open('test_discreteBarChart.html', 'w')

type = "discreteBarChart"
chart_name = "discreteBarChart"
chart = discreteBarChart(name='mygraphname', height=400, width=600, show_values=True, extras="d3.selectAll('#mygraphname text').style('fill', 'red')")
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
xdata = ["A", "B", "C", "D", "E", "F", "G"]
Expand All @@ -33,7 +33,7 @@

output_file = open('test_discreteBarChart2.html', 'w')

type = "discreteBarChart"
chart_name = "discreteBarChart"
chart = discreteBarChart(name='mygraphname', height=400, width=600,
tooltips=False)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
Expand Down
4 changes: 2 additions & 2 deletions examples/discreteBarChart_with_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Open File for test
output_file = open('test_discreteBarChart_with_date.html', 'w')

type = "discreteBarChart"
chart_name = "discreteBarChart"

start_time = int(time.mktime(datetime.datetime(2012, 6, 1).timetuple()) * 1000)
nb_element = 10
Expand All @@ -27,7 +27,7 @@
xdata = [start_time + x * 1000000000 for x in xdata]
ydata = [i + random.randint(1, 10) for i in range(nb_element)]

chart = discreteBarChart(name=type, height=400, width=600, x_is_date=True, x_axis_format="%d-%b")
chart = discreteBarChart(name=chart_name, height=400, width=600, x_is_date=True, x_axis_format="%d-%b")
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}}
Expand Down
8 changes: 4 additions & 4 deletions examples/ipythonDemo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
},
"outputs": [],
"source": [
"type = 'stackedAreaChart'\n",
"chart2 = nvd3.stackedAreaChart(name=type,height=450,width=500, \n",
"chart_name = 'stackedAreaChart'\n",
"chart2 = nvd3.stackedAreaChart(name=chart_name,height=450,width=500, \n",
" use_interactive_guideline=True)\n",
"nb_element = 50\n",
"xdata = range(nb_element)\n",
Expand Down Expand Up @@ -142,8 +142,8 @@
},
"outputs": [],
"source": [
"type = 'pieChart'\n",
"chart1 = nvd3.pieChart(name=type, color_category='category20c', height=450, width=450)\n",
"chart_name = 'pieChart'\n",
"chart1 = nvd3.pieChart(name=chart_name, color_category='category20c', height=450, width=450)\n",
"chart1.set_containerheader(\"\\n\\n<h2>\" + type + \"</h2>\\n\\n\")\n",
"\n",
"#Create the keys\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/lineChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# Open File for test
output_file = open('test_lineChart.html', 'w')
# ---------------------------------------
type = "lineChart"
chart = lineChart(name=type, x_is_date=False, x_axis_format="AM_PM")
chart_name = "lineChart"
chart = lineChart(name=chart_name, x_is_date=False, x_axis_format="AM_PM")

xdata = list(range(0, 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]
Expand Down
4 changes: 2 additions & 2 deletions examples/lineChartXY.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

output_file = open('test_lineChartXY.html', 'w')

type = "lineChart"
chart = lineChart(name=type, x_is_date=False,
chart_name = "lineChart"
chart = lineChart(name=chart_name, x_is_date=False,
x_axis_format=".1f", y_axis_format=".1f",
width=500, height=500,
show_legend=False)
Expand Down
4 changes: 2 additions & 2 deletions examples/linePlusBarChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@


output_file = open('test_linePlusBarChart.html', 'w')
type = "linePlusBarChart"
chart = linePlusBarChart(name=type, height=350, width=750,
chart_name = "linePlusBarChart"
chart = linePlusBarChart(name=chart_name, height=350, width=750,
x_is_date=True, x_axis_format="%d %b %Y",
focus_enable=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
Expand Down
4 changes: 2 additions & 2 deletions examples/lineWithFocusChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# Open File for test
output_file = open('test_lineWithFocusChart.html', 'w')
# ---------------------------------------
type = "lineWithFocusChart"
chart = lineWithFocusChart(name=type, height=550, width=850,
chart_name = "lineWithFocusChart"
chart = lineWithFocusChart(name=chart_name, height=550, width=850,
color_category='category20b', x_is_date=True,
x_axis_format="%d %b %Y %H", focus_enable=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
Expand Down
4 changes: 2 additions & 2 deletions examples/multiBarChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# Open File for test
output_file = open('test_multiBarChart.html', 'w')

type = "multiBarChart"
chart = multiBarChart(name=type, height=350)
chart_name = "multiBarChart"
chart = multiBarChart(name=chart_name, height=350)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
chart.callback = '''
function(){
Expand Down
4 changes: 2 additions & 2 deletions examples/multiBarChart_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
# Open File for test
output_file = open('test_multiBarChart_date.html', 'w')

type = "multiBarChart"
chart_name = "multiBarChart"

chart = multiBarChart(name=type, height=350, x_is_date=True)
chart = multiBarChart(name=chart_name, height=350, x_is_date=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

nb_element = 100
Expand Down
4 changes: 2 additions & 2 deletions examples/multiBarHorizontalChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# Open File for test
output_file = open('test_multiBarHorizontalChart.html', 'w')

type = "multiBarHorizontalChart"
chart = multiBarHorizontalChart(name=type, height=350)
chart_name = "multiBarHorizontalChart"
chart = multiBarHorizontalChart(name=chart_name, height=350)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

nb_element = 10
Expand Down
4 changes: 2 additions & 2 deletions examples/multiChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# Open File for test
output_file = open('test_multiChart.html', 'w')
# ---------------------------------------
type = "multiChart"
chart = multiChart(name=type, x_is_date=False, x_axis_format="AM_PM")
chart_name = "multiChart"
chart = multiChart(name=chart_name, x_is_date=False, x_axis_format="AM_PM")

xdata = [1,2,3,4,5,6]
ydata = [115.5,160.5,108,145.5,84,70.5]
Expand Down
4 changes: 2 additions & 2 deletions examples/pieChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# Open File for test
output_file = open('test_pieChart.html', 'w')

type = "pieChart"
chart = pieChart(name=type, color_category='category20c', height=400, width=400, extras="d3.selectAll('#piechart .nv-slice').style('opacity', 0.5);")
chart_name = "pieChart"
chart = pieChart(name=chart_name, color_category='category20c', height=400, width=400, extras="d3.selectAll('#piechart .nv-slice').style('opacity', 0.5);")
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
chart.callback = '''
function(){
Expand Down
4 changes: 2 additions & 2 deletions examples/scatterChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# Open File for test
output_file = open('test_scatterChart.html', 'w')

type = "scatterChart"
chart = scatterChart(name=type, height=350, width=800, x_is_date=False)
chart_name = "scatterChart"
chart = scatterChart(name=chart_name, height=350, width=800, x_is_date=False)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
nb_element = 50
xdata = [i + random.randint(1, 10) for i in range(nb_element)]
Expand Down
2 changes: 1 addition & 1 deletion nvd3/bulletChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class bulletChart(TemplateMixin, NVD3Chart):
Python example:

from nvd3.bulletChart import bulletChart
chart = bulletChart.bulletChart(name=type, height=100, width=500)
chart = bulletChart.bulletChart(name=chart_name, height=100, width=500)
title = 'Revenue',
subtitle = 'US$, in thousands'
ranges = [150, 225, 300]
Expand Down
4 changes: 2 additions & 2 deletions nvd3/multiChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class multiChart(TemplateMixin, NVD3Chart):
Python example::

from nvd3 import multiChart
type = "multiChart"
chart = multiChart(name=type, x_is_date=False, x_axis_format="AM_PM")
chart_name = "multiChart"
chart = multiChart(name=chart_name, x_is_date=False, x_axis_format="AM_PM")

xdata = [1,2,3,4,5,6]
ydata = [115.5,160.5,108,145.5,84,70.5]
Expand Down
Loading
Loading