-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from highcharts/main
add chart and trim options
- Loading branch information
Showing
6 changed files
with
541 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#csv { | ||
display: none; | ||
} | ||
|
||
.highcharts-figure, | ||
.highcharts-data-table table { | ||
min-width: 310px; | ||
max-width: 800px; | ||
margin: 1em auto; | ||
} | ||
|
||
.highcharts-data-table table { | ||
font-family: Verdana, sans-serif; | ||
border-collapse: collapse; | ||
border: 1px solid #ebebeb; | ||
margin: 10px auto; | ||
text-align: center; | ||
width: 100%; | ||
max-width: 500px; | ||
} | ||
|
||
.highcharts-data-table caption { | ||
padding: 1em 0; | ||
font-size: 1.2em; | ||
color: #555; | ||
} | ||
|
||
.highcharts-data-table th { | ||
font-weight: 600; | ||
padding: 0.5em; | ||
} | ||
|
||
.highcharts-data-table td, | ||
.highcharts-data-table th, | ||
.highcharts-data-table caption { | ||
padding: 0.5em; | ||
} | ||
|
||
.highcharts-data-table thead tr, | ||
.highcharts-data-table tr:nth-child(even) { | ||
background: #f8f8f8; | ||
} | ||
|
||
.highcharts-data-table tr:hover { | ||
background: #f1f7ff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
console.log("bork") | ||
const propNameMap = { | ||
title: "Title", | ||
subtitle: "Subtitle", | ||
tooltip: "Tooltip" | ||
} | ||
const propValueMap = { | ||
fontSize: { | ||
small: "8pt", | ||
"small+": "10pt", | ||
medium: "12pt", | ||
"medium+": "14pt", | ||
large: "16pt" | ||
} | ||
} | ||
const parseProps = (highchartsPropName) => { | ||
let styleObject = {} | ||
let propName = propNameMap[highchartsPropName] | ||
console.log(highchartsPropName) | ||
props.Text["Font Size"].Title.value ? propMap["Font Size"][props.Text["Font Size"].Title.value] : undefined | ||
if (props.Text["Font Size"][propName].value) { | ||
styleObject.fontSize = propValueMap.fontSize[props.Text["Font Size"][propName].value] | ||
} | ||
console.log(styleObject) | ||
return styleObject | ||
} | ||
Highcharts.chart('container', { | ||
title: { | ||
text: 'Estimated US Energy Consumption in 2017', | ||
style: parseProps("title") | ||
}, | ||
subtitle: { | ||
text: | ||
'Source: <a href=\'https://www.llnl.gov/\'> Lawrence Livermore National Laboratory</a>', | ||
style: parseProps("subtitle") | ||
}, | ||
accessibility: { | ||
point: { | ||
valueDescriptionFormat: '{index}. {point.from} to {point.to}, ' + | ||
'{point.weight}.' | ||
} | ||
}, | ||
tooltip: { | ||
headerFormat: null, | ||
pointFormat: | ||
'{point.fromNode.name} \u2192 {point.toNode.name}: {point.weight:.2f} ' + | ||
'quads', | ||
nodeFormat: '{point.name}: {point.sum:.2f} quads', | ||
style: parseProps("tooltip") | ||
}, | ||
series: [{ | ||
keys: ['from', 'to', 'weight'], | ||
nodes: [ | ||
{ | ||
id: 'Electricity & Heat', | ||
color: '#ffa500', | ||
offset: -110 | ||
}, | ||
{ | ||
id: 'Residential', | ||
color: '#74ffe7', | ||
column: 2, | ||
offset: 50 | ||
}, | ||
{ | ||
id: 'Commercial', | ||
color: '#8cff74', | ||
column: 2, | ||
offset: 50 | ||
}, | ||
{ | ||
id: 'Industrial', | ||
color: '#ff8da1', | ||
column: 2, | ||
offset: 50 | ||
}, | ||
{ | ||
id: 'Transportation', | ||
color: '#f4c0ff', | ||
column: 2, | ||
offset: 50 | ||
}, | ||
{ | ||
id: 'Rejected Energy', | ||
color: '#e6e6e6', | ||
column: 3, | ||
offset: -30 | ||
}, | ||
{ | ||
id: 'Energy Services', | ||
color: '#F9E79F', | ||
column: 3 | ||
}, | ||
{ | ||
id: 'Solar', | ||
color: '#009c00' | ||
}, | ||
{ | ||
id: 'Nuclear', | ||
color: '#1a8dff' | ||
}, | ||
{ | ||
id: 'Hydro', | ||
color: '#009c00' | ||
}, | ||
{ | ||
id: 'Wind', | ||
color: '#009c00' | ||
}, | ||
{ | ||
id: 'Geothermal', | ||
color: '#009c00' | ||
}, | ||
{ | ||
id: 'Natural Gas', | ||
color: '#1a8dff' | ||
}, | ||
{ | ||
id: 'Biomass', | ||
color: '#009c00' | ||
}, | ||
{ | ||
id: 'Coal', | ||
color: '#989898' | ||
}, | ||
{ | ||
id: 'Petroleum', | ||
color: '#989898', | ||
offset: -1 | ||
} | ||
], | ||
data: [ | ||
['Solar', 'Electricity & Heat', 0.48], | ||
['Nuclear', 'Electricity & Heat', 8.42], | ||
['Hydro', 'Electricity & Heat', 2.75], | ||
['Wind', 'Electricity & Heat', 2.35], | ||
['Geothermal', 'Electricity & Heat', 0.15], | ||
['Natural Gas', 'Electricity & Heat', 9.54], | ||
['Coal', 'Electricity & Heat', 12.7], | ||
['Biomass', 'Electricity & Heat', 0.52], | ||
['Petroleum', 'Electricity & Heat', 0.21], | ||
|
||
['Electricity & Heat', 'Residential', 4.7], | ||
['Solar', 'Residential', 0.19], | ||
['Geothermal', 'Residential', 0.04], | ||
['Natural Gas', 'Residential', 4.58], | ||
['Biomass', 'Residential', 0.33], | ||
['Petroleum', 'Residential', 0.88], | ||
|
||
['Electricity & Heat', 'Commercial', 4.6], | ||
['Solar', 'Commercial', 0.08], | ||
['Geothermal', 'Commercial', 0.02], | ||
['Natural Gas', 'Commercial', 3.29], | ||
['Coal', 'Commercial', 0.02], | ||
['Biomass', 'Commercial', 0.16], | ||
['Petroleum', 'Commercial', 0.83], | ||
|
||
['Electricity & Heat', 'Industrial', 3.23], | ||
['Solar', 'Industrial', 0.02], | ||
['Hydro', 'Industrial', 0.01], | ||
['Natural Gas', 'Industrial', 9.84], | ||
['Coal', 'Industrial', 1.24], | ||
['Biomass', 'Industrial', 2.48], | ||
['Petroleum', 'Industrial', 8.38], | ||
|
||
['Electricity & Heat', 'Transportation', 0.03], | ||
['Natural Gas', 'Transportation', 0.76], | ||
['Biomass', 'Transportation', 1.43], | ||
['Petroleum', 'Transportation', 25.9], | ||
|
||
['Electricity & Heat', 'Rejected Energy', 24.7], | ||
['Residential', 'Rejected Energy', 3.75], | ||
['Commercial', 'Rejected Energy', 3.15], | ||
['Industrial', 'Rejected Energy', 12.9], | ||
['Transportation', 'Rejected Energy', 22.2], | ||
|
||
['Residential', 'Energy Services', 6.97], | ||
['Commercial', 'Energy Services', 5.84], | ||
['Industrial', 'Energy Services', 12.4], | ||
['Transportation', 'Energy Services', 5.91] | ||
], | ||
type: 'sankey', | ||
name: 'Sankey demo series' | ||
}] | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
<link rel="stylesheet" href="./menu.css"> | ||
<script src="https://code.highcharts.com/highcharts.js"></script> | ||
<script src="https://code.highcharts.com/modules/exporting.js"></script> | ||
<script src="https://code.highcharts.com/modules/export-data.js"></script> | ||
<script src="https://code.highcharts.com/modules/accessibility.js"></script> | ||
|
||
<figure class="highcharts-figure"> | ||
<div id="menu"></div> | ||
<div id="container"></div> | ||
<p class="highcharts-description"> | ||
(chart goes here) | ||
</p> | ||
</figure> | ||
|
||
<script src="./menu.js"></script> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="./menu.css"> | ||
<link rel="stylesheet" href="./chart.css"> | ||
<script src="https://code.highcharts.com/highcharts.js"></script> | ||
<script src="https://code.highcharts.com/modules/sankey.js"></script> | ||
<script src="https://code.highcharts.com/modules/exporting.js"></script> | ||
<script src="https://code.highcharts.com/modules/export-data.js"></script> | ||
<script src="https://code.highcharts.com/modules/accessibility.js"></script> | ||
</head> | ||
|
||
<!-- <figure class="highcharts-figure"> --> | ||
<body> | ||
<div> | ||
<div class="highcharts-responsive-two-columns"> | ||
<div class="highcharts-responsive-column-menu highcharts-hiding-children" id="menu"></div> | ||
<div class="highcharts-responsive-column-chart" id="container"> | ||
<figure class="highcharts-figure"> | ||
<div id="container"></div> | ||
<p class="highcharts-description"> | ||
Sankey charts are used to visualize data flow and volume | ||
between nodes. The wider lines indicate larger volumes. | ||
</p> | ||
</figure> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
<!-- </figure> --> | ||
|
||
<script src="./props.js"></script> | ||
<script src="./chart.js"></script> | ||
<script src="./menu.js"></script> | ||
|
||
</html> |
Oops, something went wrong.