Liveweave: Generative AI Web Editor & HTML/CSS/JS Playground
Initializing
Liveweave
Web
expand_more
home
Home
Palette
Color Explorer
arrow_outward
Polyline
Graphics Editor
arrow_outward
frame_source
Python Playground
arrow_outward
build
Tools
expand_more
restart_alt
Load "Hello Weaver!"
post_add
Generate Lorem ipsum...
code
Format HTML
code_blocks
Format CSS
data_object
Format JavaScript
library_add
Library
expand_more
A
Algolia JS
Animate CSS
Apex Charts JS
B
Bulma CSS
Bootstrap
C
Chart JS
Chartist
Create JS
D
D3
Dojo
F
Foundation
Fullpage JS
G
Granim JS
Google Charts
H
Halfmoon
J
jQuery
M
Materialize
Moment JS
Masonry JS
Milligram CSS
P
Pure CSS
Primer CSS
Popper JS
Pattern CSS
Picnic CSS
R
React JS
Raphael JS
Raisin CSS
S
Semantic UI
Skeleton CSS
Spectre CSS
Tachyons CSS
T
Tailwind
Three JS
U
UI Kit
Vis JS
W
Water CSS
download
Download
expand_more
developer_mode
Download as HTML
folder_zip
Download as .ZIP
cloud_upload
Fork
account_circle
Login
settings
Settings
expand_more
Editor font
14
px
A
A
Line number
Mini map
Word wrap
sync_alt
Reset Settings
smart_display
Run
left_panel_close
AI Assistant
dashboard
All
HTML
CSS
JS
visibility
Preview
bolt
Live Preview
terminal
JS Console
<!DOCTYPE html> <html> <head> <title>HighCharts Population Distribution</title> <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> </head> <body> <!-- Start your code here --> <figure class="highcharts-figure"> <div id="container"></div> <p class="highcharts-description"> Bar chart showing Andorran population distribution by using a mirrored horizontal column chart with stacking and two x-axes. </p> </figure> <!-- End your code here --> </body> </html>
#container { height: 400px; } .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; }
// Custom template helper Highcharts.Templating.helpers.abs = value => Math.abs(value); // Age categories const categories = [ '0-4', '5-9', '10-14', '15-19', '20-24', '25-29', '30-34', '35-40', '40-45', '45-49', '50-54', '55-59', '60-64', '65-69', '70-74', '75-79', '80-84', '80+' ]; Highcharts.chart('container', { chart: { type: 'bar' }, title: { text: 'Population pyramid for Andorra, 2023', align: 'left' }, subtitle: { text: 'Source: <a ' + 'href="https://countryeconomy.com/demography/population-structure/andorra"' + 'target="_blank">countryeconomy.com</a>', align: 'left' }, accessibility: { point: { valueDescriptionFormat: '{index}. Age {xDescription}, {value}%.' } }, xAxis: [{ categories: categories, reversed: false, labels: { step: 1 }, accessibility: { description: 'Age (male)' } }, { // mirror axis on right side opposite: true, reversed: false, categories: categories, linkedTo: 0, labels: { step: 1 }, accessibility: { description: 'Age (female)' } }], yAxis: { title: { text: null }, labels: { format: '{abs value}%' }, accessibility: { description: 'Percentage population', rangeDescription: 'Range: 0 to 5%' } }, plotOptions: { series: { stacking: 'normal', borderRadius: '50%' } }, tooltip: { format: '<b>{series.name}, age {point.category}</b><br/>' + 'Population: {(abs point.y):.2f}%' }, series: [{ name: 'Male', data: [ -1.38, -2.09, -2.45, -2.71, -2.97, -3.69, -4.04, -3.81, -4.19, -4.61, -4.56, -4.21, -3.53, -2.55, -1.82, -1.46, -0.78, -0.71 ] }, { name: 'Female', data: [ 1.35, 1.98, 2.43, 2.39, 2.71, 3.02, 3.50, 3.52, 4.03, 4.40, 4.17, 3.88, 3.29, 2.42, 1.80, 1.39, 0.99, 1.15 ] }] });
terminal
JavaScript Console
Preview
Clear
close
›
Run