Display a TEXT module step by step

0. Download all files in this tutorial.

Download TEXT.zip and click *.html file(in TEXT.zip) to open this demo in local browser!.

1. Including TEXT configuration

    Example file: TEXT01.js

    Data structure

    Users should prepare the input data in the following format (separated by tabs).

    var TEXT01 = [ "TEXT01" , {
         x: -20,
         y: 0,
         textSize: 20,
         textWeight: "bold",
         textColor: "red",
         textOpacity: 1.0,
         text: "EGFR"
      }];
    

2. Initialize TEXT configuration with data tag : TEXT01

    Prepare a <div> tag with “example” id to set the picture position your will draw in html, e.g.:

    NGCircos01 = new NGCircos(BACKGROUND01,NGCircosGenome,{ // Initialize with "BACKGROUND01" data tag

3. Source code

    When step 1 and 2 are finished, the configuration for NGCircos:

    <button class="svg-action-btn download-img" style="height: 18px;line-height: 18px;padding: 0 11px;background: #FFFFFF;border: 1px #D9D9D9 solid;border-radius: 3px;display: inline-block;font-size: 12px;outline: none;color: black">Download png ↓</button>
    <a href="javascript:(function () { var e = document.createElement('script');if (window.location.protocol === 'https:') { e.setAttribute('src', './lib/svg-crowbar.js'); } else { e.setAttribute('src', './lib/svg-crowbar.js'); } e.setAttribute('class', 'svg-crowbar'); document.body.appendChild(e); })();" style="height: 18px;line-height: 18px;padding: 0 11px;background: #FFFFFF;border: 1px #D9D9D9 solid;border-radius: 3px;display: inline-block;font-size: 12px;outline: none;color: black" >Download svg ↓</a>
    <div id="NGCircos"></div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-12">
                        <div id="NGCircos"></div>
                    </div>
                </div>
    <!-- Data configuration -->
    <script src="./lib/jquery.js"></script>
    <script src="./lib/d3.js"></script>
    <script src="./lib/NGCircos.js"></script>
    <script src="js/TEXT01.js"></script>
    <!-- Genome configuration -->
    <script>
    var TEXT01 = [ "TEXT01" , {
         x: -20,
         y: 0,
         textSize: 20,
         textWeight: "bold",
         textColor: "red",
         textOpacity: 1.0,
         text: "EGFR"
      }];
    
      var NGCircosGenome = [      // Configure your own genome here.
        [
         ["EGFR" , 1211],
        ]
      ];
      NGCircos01 = new NGCircos(TEXT01,NGCircosGenome,{       // Initialize NGCircos.js with "NGCircosGenome" and Main configuration
         target : "NGCircos",
         svgWidth : 900,
         svgHeight : 600,
         innerRadius: 246,
         outerRadius: 250,
         zoom : false,
         genomeFillColor: ["#999999"],
         ticks : {
            display : true,
            len : 5,
            color : "#000",
            textSize : 8,
            textColor : "#000",
            scale : 20
         },
         genomeLabel : {
            display : false,
            textSize : 16,
            textColor : "red",
            dx : 3.14,
            dy : "-0.95em"
         },
      });
      NGCircos01.draw_genome(NGCircos01.genomeLength);  // NGCircos.js callback
      NGCircos01.draw_genome(NGCircos01.genomeLength2); // NGCircos2.js callback second time
    </script>
    <script src="./lib/saveSvgAsPng.js"></script>
    <script>
    
          (function(){
            var downloadImg = getEle(".download-img"),
              imgName = getEle("."+NGCircos01.svgClassName);
    
            //          imgScale = getEle(".img-scale");
    
            downloadImg.addEventListener("click",function(){
              var mySvg = getEle("."+NGCircos01.svgClassName),
                //iImgScale = parseInt(imgScale.value) || 1,
                oImgName = imgName.value || NGCircos01.svgClassName;
    
    //          saveSvgAsPng(mySvg, oImgName+".png", iImgScale);
              saveSvgAsPng(mySvg, oImgName+".png");
    
            })
    
            function getEle(obj){
              var d = document;
              return d.querySelector(obj);
            }
          })()
    </script>

4. Visualization of TEXT data using NG-Circos

Download svg ↓