1.0.3 • Published 2 years ago

@sensecare/mutant-dna-chart v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

突变染色体位置图

  • 基于Echrets封装的突变染色体位置图

image.png

/*
 * 突变染色体位置
 * @param {*} id 当前选中容器
 * @param {*} seriesData 当前x轴数据
 * @param {*} chartMap 当前图表实例组合
 * @param {*} colors 颜色集合
 * @param {*} config 默认配置项
 * @param {*} clear 清空画布
 */
  import { initMutantDnaChart } from '~'

    const chartMap = new Map();
    // 散点的颜色集合
    let colors = ['red', 'blue', 'yellow', '#217371'];

    let random = (min, max) => Math.random().toFixed(2) * (max - min) + min; // 散点位置随机函数
    let seriesData = []; // 散点数据

    // mock 随机生成4对 10个散点
    for (let i = 0; i < 4; i++) {
      seriesData[i] = {
        color: colors[i],
        name: i == 0 ? 'A' : i == 1 ? 'B' : i == 2 ? 'C' : 'D',
        data: new Array(10).fill(1).map(e => {
          return [random(0, 23), random(0, 8)]; // 随机生成坐标点
        }),
      };
    }

    // 生成突变染色体位置图实例 
    initMutantDnaChart({ seriesData,id:'mutantDnaChart',colors,chartMap })