Update the docs
This commit is contained in:
parent
209a41a1f1
commit
2e2cd7171e
|
@ -8,7 +8,7 @@ SeleniumBase Chart Maker allows you to create HTML charts with Python. (Using Hi
|
|||
|
||||
([Click to see a presentation with multiple charts](https://seleniumbase.io/other/chart_presentation.html))
|
||||
|
||||
Here's how to run the example presentation with a pie chart from [GitHub => seleniumbase/SeleniumBase/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker):
|
||||
Here's how to run a simple pie chart presentation from [GitHub => seleniumbase/SeleniumBase/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker):
|
||||
|
||||
```bash
|
||||
cd examples/chart_maker
|
||||
|
@ -31,7 +31,7 @@ class MyChartMakerClass(BaseCase):
|
|||
self.begin_presentation(filename="my_chart.html")
|
||||
```
|
||||
|
||||
Here's how to run an example presentation with multiple charts: (Press the right arrow to advance to the next slide)
|
||||
Here's how to run an example presentation with multiple charts:
|
||||
|
||||
```bash
|
||||
cd examples/chart_maker
|
||||
|
@ -53,7 +53,92 @@ Here are screenshots from the examples:
|
|||
<a href="https://seleniumbase.io/other/multi_series_chart.png"><img width="500" src="https://seleniumbase.io/other/multi_series_chart.png" title="Screenshot"></a><br>
|
||||
|
||||
|
||||
### Creating new charts:
|
||||
### Here's a line chart example:
|
||||
|
||||
```python
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
class MyChartMakerClass(BaseCase):
|
||||
def test_chart_maker(self):
|
||||
self.create_presentation()
|
||||
self.create_line_chart(
|
||||
title="Time Outside", subtitle="Last Week", unit="Minutes")
|
||||
self.add_data_point("Sun", 5)
|
||||
self.add_data_point("Mon", 10)
|
||||
self.add_data_point("Tue", 20)
|
||||
self.add_data_point("Wed", 40)
|
||||
self.add_data_point("Thu", 80)
|
||||
self.add_data_point("Fri", 65)
|
||||
self.add_data_point("Sat", 50)
|
||||
self.add_slide("<p>Line Chart</p>" + self.extract_chart())
|
||||
self.begin_presentation(filename="line_chart.html", interval=8)
|
||||
```
|
||||
|
||||
#### This example is from [test_line_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/test_line_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command:
|
||||
|
||||
```bash
|
||||
pytest test_line_chart.py
|
||||
```
|
||||
|
||||
Because that presentation above has an ``interval`` set to ``8``, it will automatically advance to the next slide after 8 seconds. (Or exit if there are no more slides.)
|
||||
|
||||
|
||||
### For a more advanced example (multiple charts in a presentation):
|
||||
|
||||
```python
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
class MyChartMakerClass(BaseCase):
|
||||
|
||||
def test_chart_maker_presentation(self):
|
||||
self.create_presentation(theme="sky")
|
||||
|
||||
self.create_pie_chart(title="Automated Tests")
|
||||
self.add_data_point("Passed", 7, color="#95d96f")
|
||||
self.add_data_point("Untested", 2, color="#eaeaea")
|
||||
self.add_data_point("Failed", 1, color="#f1888f")
|
||||
self.add_slide("<p>Pie Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_bar_chart(title="Language", libs=False)
|
||||
self.add_data_point("Python", 33, color="Orange")
|
||||
self.add_data_point("JavaScript", 27, color="Teal")
|
||||
self.add_data_point("HTML + CSS", 21, color="Purple")
|
||||
self.add_slide("<p>Bar Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_column_chart(title="Colors", libs=False)
|
||||
self.add_data_point("Red", 10, color="Red")
|
||||
self.add_data_point("Green", 25, color="Green")
|
||||
self.add_data_point("Blue", 15, color="Blue")
|
||||
self.add_slide("<p>Column Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_line_chart(title="Last Week's Data", libs=False)
|
||||
self.add_data_point("Sun", 5)
|
||||
self.add_data_point("Mon", 10)
|
||||
self.add_data_point("Tue", 20)
|
||||
self.add_data_point("Wed", 40)
|
||||
self.add_data_point("Thu", 80)
|
||||
self.add_data_point("Fri", 65)
|
||||
self.add_data_point("Sat", 50)
|
||||
self.add_slide("<p>Line Chart</p>" + self.extract_chart())
|
||||
|
||||
self.begin_presentation(filename="chart_presentation.html")
|
||||
```
|
||||
|
||||
Here's how to run that example:
|
||||
|
||||
```bash
|
||||
cd examples/chart_maker
|
||||
pytest chart_presentation.py
|
||||
```
|
||||
|
||||
(Press the Right Arrow to advance to the next slide in that chart presentation)
|
||||
|
||||
([Click to see a live example of that presentation](https://seleniumbase.io/other/chart_presentation.html))
|
||||
|
||||
Multi-Series charts can also be created. Try the available examples to learn more.
|
||||
|
||||
|
||||
## Chart Maker API
|
||||
|
||||
```python
|
||||
self.create_pie_chart(
|
||||
|
@ -151,8 +236,8 @@ self.create_area_chart(
|
|||
zero - If True, the y-axis always starts at 0. (Default: False).
|
||||
libs - The option to include Chart libraries (JS and CSS files).
|
||||
Should be set to True (default) for the first time creating
|
||||
a chart on a web page. If creating multiple charts on
|
||||
a web page, you no longer need to re-import the libraries
|
||||
a chart on a web page. If creating multiple charts on the
|
||||
same web page, you won't need to re-import the libraries
|
||||
when creating additional charts.
|
||||
"""
|
||||
```
|
||||
|
@ -176,6 +261,7 @@ self.add_data_point(label, value, color=None, chart_name=None):
|
|||
"""
|
||||
```
|
||||
|
||||
|
||||
### Adding a new data series to an existing chart:
|
||||
|
||||
```python
|
||||
|
@ -233,88 +319,4 @@ self.display_chart(chart_name=None, filename=None):
|
|||
"""
|
||||
```
|
||||
|
||||
All methods have the optional ``chart_name`` argument, which is only needed if you're creating multiple charts at the same time.
|
||||
|
||||
|
||||
### Here's an example of using SeleniumBase Chart Maker:
|
||||
|
||||
```python
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
class MyChartMakerClass(BaseCase):
|
||||
def test_chart_maker(self):
|
||||
self.create_presentation()
|
||||
self.create_line_chart(
|
||||
title="Time Outside", subtitle="Last Week", unit="Minutes")
|
||||
self.add_data_point("Sun", 5)
|
||||
self.add_data_point("Mon", 10)
|
||||
self.add_data_point("Tue", 20)
|
||||
self.add_data_point("Wed", 40)
|
||||
self.add_data_point("Thu", 80)
|
||||
self.add_data_point("Fri", 65)
|
||||
self.add_data_point("Sat", 50)
|
||||
self.add_slide("<p>Line Chart</p>" + self.extract_chart())
|
||||
self.begin_presentation(filename="line_chart.html", interval=8)
|
||||
```
|
||||
|
||||
#### This example is from [test_line_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/test_line_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command:
|
||||
|
||||
```bash
|
||||
pytest test_line_chart.py
|
||||
```
|
||||
|
||||
Because that presentation above has an ``interval`` set to ``8``, it will automatically advance to the next slide after 8 seconds. (Or exit if there are no more slides.)
|
||||
|
||||
### For a more advanced example (multiple charts in a presentation):
|
||||
|
||||
```python
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
class MyChartMakerClass(BaseCase):
|
||||
|
||||
def test_chart_maker_presentation(self):
|
||||
self.create_presentation(theme="sky")
|
||||
|
||||
self.create_pie_chart(title="Automated Tests")
|
||||
self.add_data_point("Passed", 7, color="#95d96f")
|
||||
self.add_data_point("Untested", 2, color="#eaeaea")
|
||||
self.add_data_point("Failed", 1, color="#f1888f")
|
||||
self.add_slide("<p>Pie Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_bar_chart(title="Language", libs=False)
|
||||
self.add_data_point("Python", 33, color="Orange")
|
||||
self.add_data_point("JavaScript", 27, color="Teal")
|
||||
self.add_data_point("HTML + CSS", 21, color="Purple")
|
||||
self.add_slide("<p>Bar Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_column_chart(title="Colors", libs=False)
|
||||
self.add_data_point("Red", 10, color="Red")
|
||||
self.add_data_point("Green", 25, color="Green")
|
||||
self.add_data_point("Blue", 15, color="Blue")
|
||||
self.add_slide("<p>Column Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_line_chart(title="Last Week's Data", libs=False)
|
||||
self.add_data_point("Sun", 5)
|
||||
self.add_data_point("Mon", 10)
|
||||
self.add_data_point("Tue", 20)
|
||||
self.add_data_point("Wed", 40)
|
||||
self.add_data_point("Thu", 80)
|
||||
self.add_data_point("Fri", 65)
|
||||
self.add_data_point("Sat", 50)
|
||||
self.add_slide("<p>Line Chart</p>" + self.extract_chart())
|
||||
|
||||
self.begin_presentation(filename="chart_presentation.html")
|
||||
```
|
||||
|
||||
Here's how to run that example:
|
||||
|
||||
```bash
|
||||
cd examples/chart_maker
|
||||
pytest chart_presentation.py
|
||||
```
|
||||
|
||||
(Press the Right Arrow to advance to the next slide in that chart presentation)
|
||||
|
||||
([Click to see a live example of that presentation](https://seleniumbase.io/other/chart_presentation.html))
|
||||
|
||||
Multi-Series charts can also be created. Try the available examples to learn more.
|
||||
All methods have the optional ``chart_name`` argument, which is only needed when storing multiple charts at the same time.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<div><a href="https://seleniumbase.io/help_docs/features_list/"><b>Features List</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/customizing_test_runs/"><b>Command Line Tutorial</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/examples/ReadMe/"><b>Usage Examples</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/demo_page"><b>Demo Page for Tests</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/how_it_works/"><b>How SeleniumBase Works</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/install_python_pip_git/"><b>Installing Python, Pip, & Git</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/virtualenv_instructions/"><b>Python Virtual Env Tutorial</b></a></div>
|
||||
|
@ -19,6 +20,8 @@
|
|||
<div><a href="https://seleniumbase.io/help_docs/translations/"><b>Language Translations</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/js_package_manager/"><b>JS Package Manager</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/examples/tour_examples/ReadMe/"><b>Tour Examples</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/examples/presenter/ReadMe/"><b>Presentation Maker</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/chart_maker/"><b>Chart Maker</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/mysql_installation/"><b>MySQL Installation Overview</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/seleniumbase/utilities/selenium_grid/ReadMe/"><b>Using the Selenium Grid</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/desired_capabilities/"><b>Browser Desired Capabilities</b></a></div>
|
||||
|
@ -30,27 +33,29 @@
|
|||
|
||||
<h3>GitHub Pages ToC (<a href="https://seleniumbase.com">seleniumbase.com</a>)</h3>
|
||||
|
||||
<div><a href="https://seleniumbase.com/help_docs/features_list.html"><b>Features List</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/customizing_test_runs.html"><b>Command Line Tutorial</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/features_list"><b>Features List</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/customizing_test_runs"><b>Command Line Tutorial</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/examples/"><b>Usage Examples</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/how_it_works.html"><b>How SeleniumBase Works</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/install_python_pip_git.html"><b>Installing Python, Pip, & Git</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/virtualenv_instructions.html"><b>Python Virtual Env Tutorial</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/install.html"><b>SeleniumBase Installation</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/webdriver_installation.html"><b>Webdriver Installation</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/verify_webdriver.html"><b>Verify Webdriver Works</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/how_it_works"><b>How SeleniumBase Works</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/install_python_pip_git"><b>Installing Python, Pip, & Git</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/virtualenv_instructions"><b>Python Virtual Env Tutorial</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/install"><b>SeleniumBase Installation</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/webdriver_installation"><b>Webdriver Installation</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/verify_webdriver"><b>Verify Webdriver Works</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/seleniumbase/console_scripts/"><b>Console Scripts Tutorial</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/mobile_testing.html"><b>Mobile Device Testing</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/method_summary.html"><b>Method Summary (API Ref)</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/translations.html"><b>Language Translations</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/js_package_manager.html"><b>JS Package Manager</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/mobile_testing"><b>Mobile Device Testing</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/method_summary"><b>Method Summary (API Ref)</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/translations"><b>Language Translations</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/js_package_manager"><b>JS Package Manager</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/examples/tour_examples/"><b>Tour Examples</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/mysql_installation.html"><b>MySQL Installation Overview</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/examples/presenter/"><b>Presentation Maker</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/chart_maker"><b>Chart Maker</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/mysql_installation"><b>MySQL Installation Overview</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/seleniumbase/utilities/selenium_grid/"><b>Using the Selenium Grid</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/desired_capabilities.html"><b>Browser Desired Capabilities</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/using_safari_driver.html"><b>Safari Driver Detailed Info</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/hidden_files_info.html"><b>Seeing Hidden Files on macOS</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/happy_customers.html"><b>Case Studies</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/desired_capabilities"><b>Browser Desired Capabilities</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/using_safari_driver"><b>Safari Driver Detailed Info</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/hidden_files_info"><b>Seeing Hidden Files on macOS</b></a></div>
|
||||
<div><a href="https://seleniumbase.com/help_docs/happy_customers"><b>Case Studies</b></a></div>
|
||||
|
||||
--------
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ SeleniumBase Chart Maker allows you to create HTML charts with Python. (Using Hi
|
|||
|
||||
([Click to see a presentation with multiple charts](https://seleniumbase.io/other/chart_presentation.html))
|
||||
|
||||
Here's how to run the example presentation with a pie chart from [GitHub => seleniumbase/SeleniumBase/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker):
|
||||
Here's how to run a simple pie chart presentation from [GitHub => seleniumbase/SeleniumBase/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker):
|
||||
|
||||
```bash
|
||||
cd examples/chart_maker
|
||||
|
@ -31,7 +31,7 @@ class MyChartMakerClass(BaseCase):
|
|||
self.begin_presentation(filename="my_chart.html")
|
||||
```
|
||||
|
||||
Here's how to run an example presentation with multiple charts: (Press the right arrow to advance to the next slide)
|
||||
Here's how to run an example presentation with multiple charts:
|
||||
|
||||
```bash
|
||||
cd examples/chart_maker
|
||||
|
@ -53,7 +53,92 @@ Here are screenshots from the examples:
|
|||
<a href="https://seleniumbase.io/other/multi_series_chart.png"><img width="500" src="https://seleniumbase.io/other/multi_series_chart.png" title="Screenshot"></a><br>
|
||||
|
||||
|
||||
### Creating new charts:
|
||||
### Here's a line chart example:
|
||||
|
||||
```python
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
class MyChartMakerClass(BaseCase):
|
||||
def test_chart_maker(self):
|
||||
self.create_presentation()
|
||||
self.create_line_chart(
|
||||
title="Time Outside", subtitle="Last Week", unit="Minutes")
|
||||
self.add_data_point("Sun", 5)
|
||||
self.add_data_point("Mon", 10)
|
||||
self.add_data_point("Tue", 20)
|
||||
self.add_data_point("Wed", 40)
|
||||
self.add_data_point("Thu", 80)
|
||||
self.add_data_point("Fri", 65)
|
||||
self.add_data_point("Sat", 50)
|
||||
self.add_slide("<p>Line Chart</p>" + self.extract_chart())
|
||||
self.begin_presentation(filename="line_chart.html", interval=8)
|
||||
```
|
||||
|
||||
#### This example is from [test_line_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/test_line_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command:
|
||||
|
||||
```bash
|
||||
pytest test_line_chart.py
|
||||
```
|
||||
|
||||
Because that presentation above has an ``interval`` set to ``8``, it will automatically advance to the next slide after 8 seconds. (Or exit if there are no more slides.)
|
||||
|
||||
|
||||
### For a more advanced example (multiple charts in a presentation):
|
||||
|
||||
```python
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
class MyChartMakerClass(BaseCase):
|
||||
|
||||
def test_chart_maker_presentation(self):
|
||||
self.create_presentation(theme="sky")
|
||||
|
||||
self.create_pie_chart(title="Automated Tests")
|
||||
self.add_data_point("Passed", 7, color="#95d96f")
|
||||
self.add_data_point("Untested", 2, color="#eaeaea")
|
||||
self.add_data_point("Failed", 1, color="#f1888f")
|
||||
self.add_slide("<p>Pie Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_bar_chart(title="Language", libs=False)
|
||||
self.add_data_point("Python", 33, color="Orange")
|
||||
self.add_data_point("JavaScript", 27, color="Teal")
|
||||
self.add_data_point("HTML + CSS", 21, color="Purple")
|
||||
self.add_slide("<p>Bar Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_column_chart(title="Colors", libs=False)
|
||||
self.add_data_point("Red", 10, color="Red")
|
||||
self.add_data_point("Green", 25, color="Green")
|
||||
self.add_data_point("Blue", 15, color="Blue")
|
||||
self.add_slide("<p>Column Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_line_chart(title="Last Week's Data", libs=False)
|
||||
self.add_data_point("Sun", 5)
|
||||
self.add_data_point("Mon", 10)
|
||||
self.add_data_point("Tue", 20)
|
||||
self.add_data_point("Wed", 40)
|
||||
self.add_data_point("Thu", 80)
|
||||
self.add_data_point("Fri", 65)
|
||||
self.add_data_point("Sat", 50)
|
||||
self.add_slide("<p>Line Chart</p>" + self.extract_chart())
|
||||
|
||||
self.begin_presentation(filename="chart_presentation.html")
|
||||
```
|
||||
|
||||
Here's how to run that example:
|
||||
|
||||
```bash
|
||||
cd examples/chart_maker
|
||||
pytest chart_presentation.py
|
||||
```
|
||||
|
||||
(Press the Right Arrow to advance to the next slide in that chart presentation)
|
||||
|
||||
([Click to see a live example of that presentation](https://seleniumbase.io/other/chart_presentation.html))
|
||||
|
||||
Multi-Series charts can also be created. Try the available examples to learn more.
|
||||
|
||||
|
||||
## Chart Maker API
|
||||
|
||||
```python
|
||||
self.create_pie_chart(
|
||||
|
@ -151,8 +236,8 @@ self.create_area_chart(
|
|||
zero - If True, the y-axis always starts at 0. (Default: False).
|
||||
libs - The option to include Chart libraries (JS and CSS files).
|
||||
Should be set to True (default) for the first time creating
|
||||
a chart on a web page. If creating multiple charts on
|
||||
a web page, you no longer need to re-import the libraries
|
||||
a chart on a web page. If creating multiple charts on the
|
||||
same web page, you won't need to re-import the libraries
|
||||
when creating additional charts.
|
||||
"""
|
||||
```
|
||||
|
@ -176,6 +261,7 @@ self.add_data_point(label, value, color=None, chart_name=None):
|
|||
"""
|
||||
```
|
||||
|
||||
|
||||
### Adding a new data series to an existing chart:
|
||||
|
||||
```python
|
||||
|
@ -233,88 +319,4 @@ self.display_chart(chart_name=None, filename=None):
|
|||
"""
|
||||
```
|
||||
|
||||
All methods have the optional ``chart_name`` argument, which is only needed if you're creating multiple charts at the same time.
|
||||
|
||||
|
||||
### Here's an example of using SeleniumBase Chart Maker:
|
||||
|
||||
```python
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
class MyChartMakerClass(BaseCase):
|
||||
def test_chart_maker(self):
|
||||
self.create_presentation()
|
||||
self.create_line_chart(
|
||||
title="Time Outside", subtitle="Last Week", unit="Minutes")
|
||||
self.add_data_point("Sun", 5)
|
||||
self.add_data_point("Mon", 10)
|
||||
self.add_data_point("Tue", 20)
|
||||
self.add_data_point("Wed", 40)
|
||||
self.add_data_point("Thu", 80)
|
||||
self.add_data_point("Fri", 65)
|
||||
self.add_data_point("Sat", 50)
|
||||
self.add_slide("<p>Line Chart</p>" + self.extract_chart())
|
||||
self.begin_presentation(filename="line_chart.html", interval=8)
|
||||
```
|
||||
|
||||
#### This example is from [test_line_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/test_line_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command:
|
||||
|
||||
```bash
|
||||
pytest test_line_chart.py
|
||||
```
|
||||
|
||||
Because that presentation above has an ``interval`` set to ``8``, it will automatically advance to the next slide after 8 seconds. (Or exit if there are no more slides.)
|
||||
|
||||
### For a more advanced example (multiple charts in a presentation):
|
||||
|
||||
```python
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
class MyChartMakerClass(BaseCase):
|
||||
|
||||
def test_chart_maker_presentation(self):
|
||||
self.create_presentation(theme="sky")
|
||||
|
||||
self.create_pie_chart(title="Automated Tests")
|
||||
self.add_data_point("Passed", 7, color="#95d96f")
|
||||
self.add_data_point("Untested", 2, color="#eaeaea")
|
||||
self.add_data_point("Failed", 1, color="#f1888f")
|
||||
self.add_slide("<p>Pie Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_bar_chart(title="Language", libs=False)
|
||||
self.add_data_point("Python", 33, color="Orange")
|
||||
self.add_data_point("JavaScript", 27, color="Teal")
|
||||
self.add_data_point("HTML + CSS", 21, color="Purple")
|
||||
self.add_slide("<p>Bar Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_column_chart(title="Colors", libs=False)
|
||||
self.add_data_point("Red", 10, color="Red")
|
||||
self.add_data_point("Green", 25, color="Green")
|
||||
self.add_data_point("Blue", 15, color="Blue")
|
||||
self.add_slide("<p>Column Chart</p>" + self.extract_chart())
|
||||
|
||||
self.create_line_chart(title="Last Week's Data", libs=False)
|
||||
self.add_data_point("Sun", 5)
|
||||
self.add_data_point("Mon", 10)
|
||||
self.add_data_point("Tue", 20)
|
||||
self.add_data_point("Wed", 40)
|
||||
self.add_data_point("Thu", 80)
|
||||
self.add_data_point("Fri", 65)
|
||||
self.add_data_point("Sat", 50)
|
||||
self.add_slide("<p>Line Chart</p>" + self.extract_chart())
|
||||
|
||||
self.begin_presentation(filename="chart_presentation.html")
|
||||
```
|
||||
|
||||
Here's how to run that example:
|
||||
|
||||
```bash
|
||||
cd examples/chart_maker
|
||||
pytest chart_presentation.py
|
||||
```
|
||||
|
||||
(Press the Right Arrow to advance to the next slide in that chart presentation)
|
||||
|
||||
([Click to see a live example of that presentation](https://seleniumbase.io/other/chart_presentation.html))
|
||||
|
||||
Multi-Series charts can also be created. Try the available examples to learn more.
|
||||
All methods have the optional ``chart_name`` argument, which is only needed when storing multiple charts at the same time.
|
||||
|
|
|
@ -21,7 +21,6 @@ you can try finding one from one of following sites:
|
|||
|
||||
PROXY_LIST = {
|
||||
"example1": "82.200.233.4:3128", # (Example) - set your own proxy here
|
||||
"example2": "105.112.8.53:3128", # (Example) - set your own proxy here
|
||||
"proxy1": None,
|
||||
"proxy2": None,
|
||||
"proxy3": None,
|
||||
|
|
|
@ -3498,8 +3498,8 @@ class BaseCase(unittest.TestCase):
|
|||
unit - The description label given to the chart's y-axis values.
|
||||
libs - The option to include Chart libraries (JS and CSS files).
|
||||
Should be set to True (default) for the first time creating
|
||||
a chart on a web page. If creating multiple charts on
|
||||
a web page, you no longer need to re-import the libraries
|
||||
a chart on a web page. If creating multiple charts on the
|
||||
same web page, you won't need to re-import the libraries
|
||||
when creating additional charts.
|
||||
"""
|
||||
if not chart_name:
|
||||
|
@ -3524,8 +3524,8 @@ class BaseCase(unittest.TestCase):
|
|||
unit - The description label given to the chart's y-axis values.
|
||||
libs - The option to include Chart libraries (JS and CSS files).
|
||||
Should be set to True (default) for the first time creating
|
||||
a chart on a web page. If creating multiple charts on
|
||||
a web page, you no longer need to re-import the libraries
|
||||
a chart on a web page. If creating multiple charts on the
|
||||
same web page, you won't need to re-import the libraries
|
||||
when creating additional charts.
|
||||
"""
|
||||
if not chart_name:
|
||||
|
@ -3550,8 +3550,8 @@ class BaseCase(unittest.TestCase):
|
|||
unit - The description label given to the chart's y-axis values.
|
||||
libs - The option to include Chart libraries (JS and CSS files).
|
||||
Should be set to True (default) for the first time creating
|
||||
a chart on a web page. If creating multiple charts on
|
||||
a web page, you no longer need to re-import the libraries
|
||||
a chart on a web page. If creating multiple charts on the
|
||||
same web page, you won't need to re-import the libraries
|
||||
when creating additional charts.
|
||||
"""
|
||||
if not chart_name:
|
||||
|
@ -3577,8 +3577,8 @@ class BaseCase(unittest.TestCase):
|
|||
zero - If True, the y-axis always starts at 0. (Default: False).
|
||||
libs - The option to include Chart libraries (JS and CSS files).
|
||||
Should be set to True (default) for the first time creating
|
||||
a chart on a web page. If creating multiple charts on
|
||||
a web page, you no longer need to re-import the libraries
|
||||
a chart on a web page. If creating multiple charts on the
|
||||
same web page, you won't need to re-import the libraries
|
||||
when creating additional charts.
|
||||
"""
|
||||
if not chart_name:
|
||||
|
@ -3604,8 +3604,8 @@ class BaseCase(unittest.TestCase):
|
|||
zero - If True, the y-axis always starts at 0. (Default: False).
|
||||
libs - The option to include Chart libraries (JS and CSS files).
|
||||
Should be set to True (default) for the first time creating
|
||||
a chart on a web page. If creating multiple charts on
|
||||
a web page, you no longer need to re-import the libraries
|
||||
a chart on a web page. If creating multiple charts on the
|
||||
same web page, you won't need to re-import the libraries
|
||||
when creating additional charts.
|
||||
"""
|
||||
if not chart_name:
|
||||
|
|
Loading…
Reference in New Issue