• Edit
  • Download
  • <!DOCTYPE html>
    <html class="zc-html">
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid: Blank Grid</title>
      <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
      <style>
        .chart--container {
          min-height: 450px;
          overflow: auto;
          position: relative;
          height: 100%;
          width: 100%;
        }
    
        .zc-ref {
          display: none;
        }
      </style>
    </head>
    
    <body class="zc-body">
    
      <!-- CHART CONTAINER -->
      <div id="myChart" class="chart--container">
        <a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a>
      </div>
    
      <script>
        ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"]; // window:load event for Javascript to run after HTML
        // because this Javascript is injected into the document head
        window.addEventListener('load', () => {
          let chartData = [{
              type: 'node',
              id: 'a',
              name: 'α'
            },
            {
              type: 'node',
              id: 'b',
              name: 'β'
            },
            {
              type: 'node',
              id: 'g',
              name: 'γ'
            },
            {
              type: 'link',
              source: 'a',
              target: 'b'
            },
            {
              type: 'link',
              source: 'a',
              target: 'g'
            },
    
            {
              type: 'node',
              id: 'd',
              name: 'δ'
            },
            {
              type: 'node',
              id: 'e',
              name: 'ε'
            },
            {
              type: 'node',
              id: 'z',
              name: 'ζ'
            },
            {
              type: 'node',
              id: 'th',
              name: 'θ'
            },
            {
              type: 'link',
              source: 'd',
              target: 'e'
            },
            {
              type: 'link',
              source: 'e',
              target: 'z'
            },
            {
              type: 'link',
              source: 'z',
              target: 'th'
            },
            {
              type: 'link',
              source: 'th',
              target: 'd'
            },
    
            {
              type: 'node',
              id: 'i',
              name: 'ι'
            },
            {
              type: 'node',
              id: 'k',
              name: 'κ'
            },
            {
              type: 'link',
              source: 'i',
              target: 'k'
            },
          ];
    
          let chartConfig = {
            type: 'tree',
            plotarea: {
              margin: '50px'
            },
            options: {
              aspect: 'graph',
              springLength: 75,
              attractionConstant: 0.8,
              repulsionConstant: 4000,
              repulsionDistanceFactor: 20,
              link: {
                lineColor: '#000',
                lineWidth: '2px',
                endPoint: {
                  type: 'triangle',
                  width: '7px',
                  length: '10px',
                  borderColor: '#505050',
                  backgroundColor: '#505050'
                },
              },
              'link[source-i]': {
                startPoint: {
                  type: 'triangle',
                  width: '7px',
                  length: '10px',
                  borderColor: '#505050',
                  backgroundColor: '#505050'
                },
              },
              node: {
                size: 24,
                borderWidth: '3px',
                borderColor: '#dedede',
                backgroundColor: '#fff',
                backgroundRepeat: 'no-repeat',
                backgroundScale: 0.75,
                label: {
                  color: '#505050',
                  fontSize: '18px'
                }
              },
            },
            series: chartData
          };
    
          zingchart.render({
            id: 'myChart',
            width: '100%',
            height: '100%',
            data: chartConfig
          });
    
        });
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html class="zc-html">
    
    <head>
      <meta charset="utf-8">
      <title>ZingGrid: Blank Grid</title>
      <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    </head>
    
    <body class="zc-body">
    
      <!-- CHART CONTAINER -->
      <div id="myChart" class="chart--container">
        <a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a>
      </div>
    
    </body>
    
    </html>
    .chart--container {
      min-height: 450px;
      overflow: auto;
      position: relative;
      height: 100%;
      width: 100%;
    }
    
    .zc-ref {
      display: none;
    }
    // window:load event for Javascript to run after HTML
    // because this Javascript is injected into the document head
    window.addEventListener('load', () => {
      let chartData = [{
          type: 'node',
          id: 'a',
          name: 'α'
        },
        {
          type: 'node',
          id: 'b',
          name: 'β'
        },
        {
          type: 'node',
          id: 'g',
          name: 'γ'
        },
        {
          type: 'link',
          source: 'a',
          target: 'b'
        },
        {
          type: 'link',
          source: 'a',
          target: 'g'
        },
    
        {
          type: 'node',
          id: 'd',
          name: 'δ'
        },
        {
          type: 'node',
          id: 'e',
          name: 'ε'
        },
        {
          type: 'node',
          id: 'z',
          name: 'ζ'
        },
        {
          type: 'node',
          id: 'th',
          name: 'θ'
        },
        {
          type: 'link',
          source: 'd',
          target: 'e'
        },
        {
          type: 'link',
          source: 'e',
          target: 'z'
        },
        {
          type: 'link',
          source: 'z',
          target: 'th'
        },
        {
          type: 'link',
          source: 'th',
          target: 'd'
        },
    
        {
          type: 'node',
          id: 'i',
          name: 'ι'
        },
        {
          type: 'node',
          id: 'k',
          name: 'κ'
        },
        {
          type: 'link',
          source: 'i',
          target: 'k'
        },
      ];
    
      let chartConfig = {
        type: 'tree',
        plotarea: {
          margin: '50px'
        },
        options: {
          aspect: 'graph',
          springLength: 75,
          attractionConstant: 0.8,
          repulsionConstant: 4000,
          repulsionDistanceFactor: 20,
          link: {
            lineColor: '#000',
            lineWidth: '2px',
            endPoint: {
              type: 'triangle',
              width: '7px',
              length: '10px',
              borderColor: '#505050',
              backgroundColor: '#505050'
            },
          },
          'link[source-i]': {
            startPoint: {
              type: 'triangle',
              width: '7px',
              length: '10px',
              borderColor: '#505050',
              backgroundColor: '#505050'
            },
          },
          node: {
            size: 24,
            borderWidth: '3px',
            borderColor: '#dedede',
            backgroundColor: '#fff',
            backgroundRepeat: 'no-repeat',
            backgroundScale: 0.75,
            label: {
              color: '#505050',
              fontSize: '18px'
            }
          },
        },
        series: chartData
      };
    
      zingchart.render({
        id: 'myChart',
        width: '100%',
        height: '100%',
        data: chartConfig
      });
    
    });