Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,height=device-height">
  <div id="mountNode"></div>
<script src="https://gw.alipayobjects.com/os/antv/assets/g2/3.0.9/g2.min.js"></script>
  <script src="https://gw.alipayobjects.com/os/antv/assets/data-set/0.8.7/data-set.min.js"></script>

              var imageMap = {
  '長照、養護人員': 'https://image.flaticon.com/icons/svg/65/65463.svg',
  '老年人口數(85~100+)': 'https://image.flaticon.com/icons/svg/773/773256.svg',
  '可供進住人數': 'https://image.flaticon.com/icons/svg/73/73784.svg',

const data = [ { name: '可供進住人數',
    '北部': 25499,
    '中部': 11027,
    '南部': 18684,
    '東部': 1609,
    '外島': 328 },
  { name: '長照、養護人員',
    '北部': 8994,
    '中部': 3518,
    '南部': 5997,
    '東部': 482,
    '外島': 73 },
  { name: '老年人口數(85~100+)',
    '北部': 162443,
    '中部': 92071,
    '南部': 101846,
    '東部': 10197,
    '外島': 2200 } ];
// const SimpleAll = [
//   {name: '可供進住人數', value: 57147},
//   {name: '長照、養護人員', value: 19064},
//   {name: '老年人口數(85~100+)', value: 368757}
// ];
  const ds = new DataSet();
  const dv = ds.createView().source(data);
    type: 'fold',
    fields: [ '北部', '中部', '南部', '東部', '外島'], // 展開資料
    key: '區域', // key
    value: '區域人數', // value
    retains: [ 'name' ]

  const chart = new G2.Chart({
    container: 'mountNode',
    forceFit: true,
    height: window.innerHeight
    type: 'dodge',
    marginRatio: 1 / 5

  chart.scale('區域人數', {
    minLimit: 73

    .position(['區域', '區域人數'])
      type: 'dodge',
      marginRatio: 1 / 5
    .shape('name', function (name) {
    return ['image', imageMap[name]];
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.