• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingSoft Demo</title>
    
      <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
      <style></style>
    </head>
    
    <body>
      <div id="myChart"></div>
      <script>
        ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
        let chartConfig = {
          "type": "bar",
          "title": {
            "text": "Standalone Labels"
          },
          "labels": [{ //Label One
              "text": "0-18 years: %plot-0-value",
              "default-value": "___", //optional placeholder for token text
              "height": "7%",
              "width": "23%",
              "x": "15%",
              "y": "12%",
              "text-align": "left", //to keep text stationary
              "font-color": "black",
              "font-family": "Georgia",
              "border-width": 2,
              "border-color": "#29A2CC",
              "border-radius": "5px",
              "padding-left": "30%"
            },
            { //Label Two
              "text": "18-64 years: %plot-1-value",
              "default-value": "___",
              "height": "7%",
              "width": "23%",
              "x": "40%",
              "y": "12%",
              "text-align": "left",
              "font-color": "black",
              "font-family": "Georgia",
              "border-width": 2,
              "border-color": "#D31E1E",
              "border-radius": "5px",
              "padding-left": "30%"
            },
            { //Label Three
              "text": "65 and over: %plot-2-value",
              "default-value": "___",
              "height": "7%",
              "width": "23%",
              "x": "65%",
              "y": "12%",
              "text-align": "left",
              "font-color": "black",
              "font-family": "Georgia",
              "border-width": 2,
              "border-color": "#7CA82B",
              "border-radius": "5px",
              "padding": "30%"
            }
          ],
          "plotarea": {
            "margin-top": "25%"
          },
          "plot": {
            "stacked": true,
            "bar-width": "30%",
            "tooltip": {
              "visible": false
            }
          },
          "crosshair-x": {
            "plot-label": {
              "visible": false
            }
          },
          "scale-x": {
            "labels": ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"]
          },
          "scale-y": {
            "values": "0:200:50"
          },
          "series": [{
              "values": [64, 59, 55, 49, 39, 35, 31, 20, 16, 15, 9, 5, 4],
              "text": "0-18 years"
            },
            {
              "values": [99, 90, 87, 70, 59, 51, 45, 39, 34, 25, 21, 9, 5],
              "text": "18-64 years"
            },
            {
              "values": [34, 30, 16, 15, 14, 12, 10, 9, 8, 7, 5, 4, 3],
              "text": "65 and over"
            }
          ]
        };
    
        zingchart.render({
          id: 'myChart',
          data: chartConfig,
          height: 400,
          width: "100%"
        });
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingSoft Demo</title>
    
      <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    </head>
    
    <body>
      <div id="myChart"></div>
    </body>
    
    </html>
    
          
    let chartConfig = {
      "type": "bar",
      "title": {
        "text": "Standalone Labels"
      },
      "labels": [{ //Label One
          "text": "0-18 years: %plot-0-value",
          "default-value": "___", //optional placeholder for token text
          "height": "7%",
          "width": "23%",
          "x": "15%",
          "y": "12%",
          "text-align": "left", //to keep text stationary
          "font-color": "black",
          "font-family": "Georgia",
          "border-width": 2,
          "border-color": "#29A2CC",
          "border-radius": "5px",
          "padding-left": "30%"
        },
        { //Label Two
          "text": "18-64 years: %plot-1-value",
          "default-value": "___",
          "height": "7%",
          "width": "23%",
          "x": "40%",
          "y": "12%",
          "text-align": "left",
          "font-color": "black",
          "font-family": "Georgia",
          "border-width": 2,
          "border-color": "#D31E1E",
          "border-radius": "5px",
          "padding-left": "30%"
        },
        { //Label Three
          "text": "65 and over: %plot-2-value",
          "default-value": "___",
          "height": "7%",
          "width": "23%",
          "x": "65%",
          "y": "12%",
          "text-align": "left",
          "font-color": "black",
          "font-family": "Georgia",
          "border-width": 2,
          "border-color": "#7CA82B",
          "border-radius": "5px",
          "padding": "30%"
        }
      ],
      "plotarea": {
        "margin-top": "25%"
      },
      "plot": {
        "stacked": true,
        "bar-width": "30%",
        "tooltip": {
          "visible": false
        }
      },
      "crosshair-x": {
        "plot-label": {
          "visible": false
        }
      },
      "scale-x": {
        "labels": ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"]
      },
      "scale-y": {
        "values": "0:200:50"
      },
      "series": [{
          "values": [64, 59, 55, 49, 39, 35, 31, 20, 16, 15, 9, 5, 4],
          "text": "0-18 years"
        },
        {
          "values": [99, 90, 87, 70, 59, 51, 45, 39, 34, 25, 21, 9, 5],
          "text": "18-64 years"
        },
        {
          "values": [34, 30, 16, 15, 14, 12, 10, 9, 8, 7, 5, 4, 3],
          "text": "65 and over"
        }
      ]
    };
    
    zingchart.render({
      id: 'myChart',
      data: chartConfig,
      height: 400,
      width: "100%"
    });