Chapter 8 Charting
When creating and manipulating charts within Opencontour, the user will have to familiarize themselves with Plotly Chart Studio. This integrated program allows users to create, edit, and share their chart data with others. This chapter is designed to give an overview of the relevant functions in Plotly Chart Studio with respect to a user's Opencontour project.
Quick Access
- Charting Methods
- Accessing Plotly Chart Studio
- Creating a Plotly Account
- Plotly Chart Studio Functions Overview
- Tutorial Project Part 6: Creating Charts
8.1 Charting Methods
Within Opencontour, there are currently four methods of producing a graph within Plotly:
- Two Properties
- Grade Tonnage Curve
- Custom
- Quick
This section will discuss how each of these charting functions differ from one another, and how a user can efficiently utilize them to plot their data.
8.1.1 Two Properties
The Two Properties charting method allows a user to plot two populated properties within their project against each other to see the trend between them. The resultant chart is always a scatter plot.
To access this method, simply click on the Create Charts button in the viewer, then click on the tab marked Two Properties. The window should look like this:
Two Properties Window

To input property data within these boxes, the user must type 'data.' before each of the properties themselves. For example, if they wanted to input silver as their 'X' property, they would have to type 'data.ag'.
For reference, here is what a chart might look like when plotting gold values versus their relative elevations:
Gold Grade vs. Elevation

NOTE: The axes and chart titles do not automatically populate for this chart and must be manually edited within Plotly Chart Studio. This will be covered more in-depth later this chapter.
8.1.2 Grade Tonnage Curve
The Grade Tonnage Curve charting method allows for the user to create their own grade tonnage curve or grade bins utilizing the data in their project.
To access this method, simply click on the Create Charts button in the viewer, then click on the tab marked Grade Tonnage Curve. The window should look like this:
Grade Tonnage Window

There are 3 primary inputs that must be satisfied for this chart to populate correctly:
- Grade: property that the grade tonnage curve or grade bins is based around (i.e. au, ag, cu, etc.)
- Low: sets the minimum cutoff grade for the grade tonnage curve
- Interval: sets the interval for cutoff grade displayed within the Plotly chart
Here is what a sample grade tonnage chart might look like for gold:
Grade Tonnage Chart

Here is what a grade bin chart would look like for the same data:
Grade Bin Chart

8.1.3 Custom Charts
The Custom charting feature allows the user to create their own personalized chart with multiple properties of their choosing.
To access this method, simply click on the Create Charts button in the viewer, then click on the tab marked Quick. The window should look like this:
Custom Charts Window

This charting method allows for users to input up to 9 different properties or script expressions to display within a chart. This also requires that the user selects a grouping for each of these properties within the dropdown menu.
For example, if a user wanted to see total tons and ore tons grouped by the period that they were mined in, this is what the menu input would look like:
Custom Charts Window w/ Inputs

And this is what the chart would look like once plotted:
Custom Charts Example

NOTE: The axes and chart titles do not automatically populate for this chart and must be manually edited within Plotly Chart Studio. This will be covered more in-depth later this chapter.
This charting window also allows users to save their own created chart template, or load in a pre-built template from Opencontour.
8.1.4 Quick Charts
The Quick charting feature allows for users to quickly create a chart by simply selecting one of the pre-built templates within Opencontour.
To access this method, simply click on the Create Charts button in the viewer, then click on the tab marked Quick. The window should look like this:
Quick Charts Window

The table below details each of the quick charts that Opencontour currently offers:
| Quick Chart Name | Description |
|---|---|
| OreWaste | Displays ore and waste by each period |
| GradeProfit | Displays comparison of grade to profit/ton of each block |
| Grades | Displays mined/processed ore for each year, along with their average mined/processed grade |
| TnsByPhase | Displays total tonnage mined in each phase |
| Costs | Displays total cost per period broken up by areas such as process, load, drill, blast, haul, etc. |
| CostPerTon | Displays total cost per year broken up by areas such as process, load, drill, blast, haul, etc. |
| MinedProcessTns | Displays mined/processed ore for each year, along with cumulative mined/processed tons |
| Destination | Displays routing destination of the ore |
| Stockpiles | Displays breakdown of mined, processed, and stockpile size by ROM type |
| Truckstudy | Displays how many truck hours are required for each period, blocked out in down, standby, productive, and non-productive time |
| TruckCount | Displays how many trucks are required for each period, blocked out in down, standby, productive, and non-productive time |
| Bench | Displays what elevation was mined during each period |
| Shovel | Displays total ore mined by shovel in each period |
| PhaseCashFlow | Displays costs and revenue for each phase, as well as cumulative cash flow and NPV |
| Cashflow | Displays cash flow for each period broken down by revenue, opex, capex, fixed mine/process, cumulative cash flow, and NPV |
| CashFlowByPhase | Displays cash flow as a line throughout each period |
Here are several examples of what these charts look like when viewed:
Grades Quick Chart

MinedProcessTns Quick Chart

Cashflow Quick Chart

8.2 Accessing Plotly Chart Studio
Though Opencontour does provide all the charting features as stated above, a user may want to customize their chart with their own color scheme, axes and chart titles, and other features that make it unique.
To do this, they will need to access Plotly Chart Studio from Opencontour. To access Plotly Chart Studio, simply click the button labeled Edit Chart that is displayed in the bottom right corner of every generated chart within Opencontour.
Edit Chart Button

Clicking this button should re-direct the user to a page that looks like this:
Plotly Chart Studio Main Window

8.3 Creating a Plotly Account
After navigating to this window, the user should then click the Create Account button in the top right corner of the screen. Though an account is not required to access Plotly Chart Studio, it does give the user access to features such as saving work, exporting files, and creating a unique theme within Plotly.
NOTE: When creating an account, Plotly will give multiple plans for the user to choose from. The free, Open-Source plan is more than sufficient to use for one's Opencontour project.
When creating an account, Plotly will ask for the following information:
- First Name
- Last Name
- Organization Name
- Role
- Organization Email
- Username
- Password
Once this information has been entered, Plotly will send a verification email to the provided email address. Be sure to click on the link in the email to verify the account.
8.4 Plotly Chart Studio Functions Overview
This section will outline each of the functions offered in Plotly Chart Studio to assist in manipulating chart data.
8.4.1 Structure
Traces
The Traces section contains each variable in the chart with the following parameters to edit:
- Chart Type
- Axis Variable Assignment
- Axes Being Used (and their names)
You can also add new traces to an existing chart using the +Trace button.
Traces Bar

Subplots
- Boundaries:
- Allows you to format size of each axis as well as how much room chart takes up in window
- X Anchor:
- Gives option to anchor the labels to a given Y or other axis
- Y Anchor:
- Gives option to anchor the labels to a given X or other axis
Subplots Bar

Transform
The Transform bar gives the user 4 options to uniquely manipulate data:
- Filter: allows user to filter data out of a trace
- Split: allows user to create multiple traces from a single source trace
- Aggregate: allows user to summarize a trace using function such as “average” or “minimum”
- Sort: allows user to sort a trace to control marker overlay or line connection order
Transform Bar

8.4.2 Theme
Choose
Choose allows a user to select a built-in or imported theme to use in their plotly project NOTE: To use a personal or shared theme requires a paid membership
Choose Bar

Create
Create allows the user to create and share their own themes. However, this is a paid feature only.
8.4.3 Style
General
- Defaults:
- Allows user to change background/chart colors, text size/font, number formatting, etc.
- Title:
- Allows user to change title description, font, color, positioning, etc.
- Modebar:
- The mode bar is located in upper-right hand corner of every plotly graph, which allows users to interact with it in various ways
- This option allows the user to customize its orientation and colors
- Size and Margins:
- Allows user to customize extents and margins of project view
- Interactions:
- Allows users to select different options for dragging, clicking, and hovering functionalities
- Meta Text:
- Allows user to refer to custom data in any text fields of editor
General Bar

Traces
For each trace in Traces, user can edit the following properties:
- Name
- Legend (Legend Group)
- Display Type (Lines, Points, Text, etc.)
- Bar Grouping and Stylization
- Points (color, size, style, etc.)
- Hover/Tooltip
- More
Traces Bar

Axes
Axes allows for editing of following axis features:
- Titles, font, color
- Range/Type
- Lines (Axis Lines, Zero Line, Grid Lines)
- Tick Labels / Tick Markers
- Range Slider
- Spike Lines
Axes Bar

Legend
Legend allows for editing of following legend features:
- Text Size/Color
- Legend Box Width/Color
- Positioning (Horizontal/Vertical)
- Orientation
Legend Bar

8.4.4 Annotate
Text
Text allows the user to create and position text and arrows to highlight certain aspects of their data. Add additional annotations by selecting the +Annotation button.
Text Bar

Shapes
Shapes allows the user to add shapes to highlight certain aspects of their data. Add additional shapes by pressing the +Shape button.
Shape Bar

Images
Images allows the user to customize charts with their own logos or images. Add additional images by pressing the +Image button.
Image Bar

8.4.5 Analyze
Curve Fitting
Curve Fitting allows the user to fit a curve to their dataset. They can choose between basic pre-built functions (linear, quadratic, exponential, etc.) and inputting a custom function.
Curve Fitting Bar

Moving Average
Moving Average allows the user to input a moving average line into their data. This function is only compatible with scatter and line charts.
Moving Average Bar

8.4.6 Export
Image
Image allows the user to save an image of their chart as a PNG, PDF, SVG, or EPS file.
Image Bar

HTML
HTML allows the user to save an HTML or Zip Archive file of their project.
HTML Bar

8.4.7 JSON
Tree
Tree displays a JSON editor that allows you to manipulate all previously mentioned functions.
Tree Bar

8.5 Tutorial Project Part 6: Creating Charts
This part of the project will outline how the user can access the Create Charts module to view their scheduled and scripted mine plan.
8.5.1 Schedule Quick Charting
- Once scripting is completed, exit the module. Then, navigate over to the Create Charts module
- Click on the Quick tab. It will look something like this:
Quick Charts Window

From this tab, there are multiple different pre-built charts to choose from:
| Quick Chart Name | Description |
|---|---|
| OreWaste | Displays ore and waste by each period |
| GradeProfit | Displays comparison of grade to profit/ton of each block |
| Grades | Displays mined/processed ore for each year, along with their average mined/processed grade |
| TnsByPhase | Displays total tonnage mined in each phase |
| Costs | Displays total cost per period broken up by areas such as process, load, drill, blast, haul, etc. |
| CostPerTon | Displays total cost per ton for each period broken up by areas such as process, load, drill, blast, haul, etc. |
| MinedProcessTns | Displays mined/processed ore for each year, along with cumulative mined/processed tons |
| Destination | Displays routing destination of the ore |
| Stockpiles | Displays breakdown of mined, processed, and stockpile size by ROM type |
| Truckstudy | Displays how many truck hours are required for each period, blocked out in down, standby, productive, and non-productive time |
| TruckCount | Displays how many trucks are required for each period, blocked out in down, standby, productive, and non-productive time |
| Bench | Displays what elevation was mined during each period |
| Shovel | Displays total ore mined by shovel in each period |
| PhaseCashFlow | Displays costs and revenue for each phase, as well as cumulative cash flow and NPV |
| Cashflow | Displays cash flow for each period broken down by revenue, opex, capex, fixed mine/process, cumulative cash flow, and NPV |
| CashFlowByPhase | Displays cash flow as a line throughout each period |
Grades Quick Chart

MinedProcessTns Quick Chart

Cashflow Quick Chart
