• 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>
        html,
        body,
        #myChart {
          height: 100%;
          width: 100%;
        }
      </style>
    </head>
    
    <body>
      <div id="myChart"></div>
      <script>
        ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
        let chartConfig = {
          graphset: [{
            type: 'mixed',
            shapes: [{
              id: 'custom-cm-button',
              type: 'circle',
              backgroundImage: 'https://www.zingchart.com/resources/heart.png',
              backgroundRepeat: 'no-repeat',
              size: 20,
              backgroundColor: "pink",
              borderWidth: 1,
              borderColor: 'red',
              x: 30,
              y: 30,
              cursor: 'hand'
            }],
            title: {
              text: 'Custom Context Menu Button'
            },
            subtitle: {
              text: 'Click the custom heart icon!',
              fontWeight: 'normal'
            },
            plot: {
              aspect: 'spline'
            },
            scaleX: {
    
            },
            scaleY: {
              values: '0:100:20',
              guide: {
                lineStyle: 'dotted'
              }
            },
            series: [{
                type: 'scatter',
                values: [81, 71, 50, 73, 34, 33, 61, 73, 36, 48, 35, 61],
                marker: {
                  size: 4,
                  backgroundColor: 'pink',
                  borderWidth: 1,
                  borderColor: 'red'
                }
              },
              {
                type: 'range',
                values: [
                  [30, 69],
                  [31, 68],
                  [35, 54],
                  [48, 51],
                  [55, 70],
                  [61, 74],
                  [73, 98],
                  [70, 87],
                  [33, 76],
                  [51, 68],
                  [49, 79],
                  [69, 93]
                ],
                lineColor: '#009900',
                backgroundColor: '#009900',
                marker: {
                  visible: false
                }
              }
            ]
          }]
        };
    
        zingchart.bind('myChart', 'shape_click', function(e) {
          if (e.shapeid === 'custom-cm-button') {
            zingchart.exec('myChart', 'showmenu', {
              x: 55,
              y: 35
            });
          }
    
        })
    
        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>
    html,
    body,
    #myChart {
      height: 100%;
      width: 100%;
    }
    let chartConfig = {
      graphset: [{
        type: 'mixed',
        shapes: [{
          id: 'custom-cm-button',
          type: 'circle',
          backgroundImage: 'https://www.zingchart.com/resources/heart.png',
          backgroundRepeat: 'no-repeat',
          size: 20,
          backgroundColor: "pink",
          borderWidth: 1,
          borderColor: 'red',
          x: 30,
          y: 30,
          cursor: 'hand'
        }],
        title: {
          text: 'Custom Context Menu Button'
        },
        subtitle: {
          text: 'Click the custom heart icon!',
          fontWeight: 'normal'
        },
        plot: {
          aspect: 'spline'
        },
        scaleX: {
    
        },
        scaleY: {
          values: '0:100:20',
          guide: {
            lineStyle: 'dotted'
          }
        },
        series: [{
            type: 'scatter',
            values: [81, 71, 50, 73, 34, 33, 61, 73, 36, 48, 35, 61],
            marker: {
              size: 4,
              backgroundColor: 'pink',
              borderWidth: 1,
              borderColor: 'red'
            }
          },
          {
            type: 'range',
            values: [
              [30, 69],
              [31, 68],
              [35, 54],
              [48, 51],
              [55, 70],
              [61, 74],
              [73, 98],
              [70, 87],
              [33, 76],
              [51, 68],
              [49, 79],
              [69, 93]
            ],
            lineColor: '#009900',
            backgroundColor: '#009900',
            marker: {
              visible: false
            }
          }
        ]
      }]
    };
    
    zingchart.bind('myChart', 'shape_click', function(e) {
      if (e.shapeid === 'custom-cm-button') {
        zingchart.exec('myChart', 'showmenu', {
          x: 55,
          y: 35
        });
      }
    
    })
    
    zingchart.render({
      id: 'myChart',
      data: chartConfig,
      height: 400,
      width: '100%'
    });