<commit_before>/**
 * highcharts配置生成辅助方法
 */
import _ from 'lodash'
import * as utils from '../utils'
import Highcharts from 'highcharts'

if (typeof Highcharts === 'undefined') {
  throw new Error(`
    Highcharts has been optimized for npm, see these links for help.
    http://www.highcharts.com/component/content/article/2-news/188-highcharts-optimized-for-npm
    http://www.hcharts.cn/subject/highcharts-4.1.10.php
  `)
}

const COLORS = [
  '#4da1ff', '#f4533c', '#ffae00', '#1aba9b', '#e552b0', '#af6bcb', '#9aab4f', '#6673d1', '#3ebb43',
  '#2c81e1', '#dd4544', '#e49518', '#0c967b', '#bd3998', '#944cb2', '#7b8d43', '#4e5ab0', '#299e2e',
  '#1665bd', '#bd3b47', '#d97707', '#06715d', '#8f2e73', '#7b3499', '#69821c', '#4a498f', '#18851d'
]

Highcharts.setOptions({
  colors: COLORS,
  lang: {
    // TODO 多语言版本以及其它基本配置
    noData: '暂无数据'
  }
})

// 获取分组配置信息，未设置的在默认分组
// {male: ['y0', 'y1'], femail: ['y3']}
function stackParser(config, names) {
  if (!config) return null
  let ret = {}
  let defaultGroupName = 'default'
  _.each(names, (val, key) => {
    ret[key] = defaultGroupName
  })

  _.each(config, (val, key) => {
    _.each(val, (name) => {
      ret[name] = key
    })
  })

  return ret
}

export const DEFAULT_LINE_OPTIONS = {
  chart : {
    backgroundColor : 'rgba(0, 0, 0, 0)'
  },
  title : {
    text : ''
  },
  legend : {
    borderWidth : 0,
    margin : 0,
    maxHeight : 50,
    itemStyle : {
      color : '#636A7C',
      fontWeight : 'normal'
    }
  },
  xAxis : {
    tickmarkPlacement : 1,
    gridLineColor : '#E8EBF2',
    gridLineWidth : 1,
    labels : {
      // x轴旋转角度
      //rotation: 30,
      //限定用多少行来显示轴轴标签自动地的避免某些标签的重叠。设置为1表示禁用重叠检测
      maxStaggerLines : 1,
      //useHTML: true,
      style : {
        fontSize : 12
      }
    }
  },
  tooltip : {
    shared : true,
    valueSuffix : '',
    backgroundColor : 'rgba(41, 55, 69, 0.8)',
    borderColor : '#010202',
    borderRadius : 5,
    shadow : true,
    hideDelay : 10, //提示框隐藏延时。当鼠标移出图标后，数据提示框会在设定的延迟时间后消失。
    style : {
      zIndex : -1,
      color : '#FFFFFF',
      'pointer-events': 'none'
    },
    crosshairs : { //控制十字线
      width : 1,
      color : '#39B54A',
      dashStyle : 'shortdot'
    },
    useHTML : true
  },
  credits : {
    enabled : false
  },
  plotOptions : {
    areaspline : {
      fillOpacity : 0.08,
      lineWidth : 2,
      //shadow: true,//是否为曲线加阴影
      marker : {
        symbol : 'circle',
        radius : 3,
        fillColor : 'white',
        lineColor : null,
        lineWidth : 1
      }
    },
    spline : {
      fillOpacity : 0.08,
      lineWidth : 2,
      //shadow: true,//是否为曲线加阴影
      marker : {
        symbol : 'circle',
        radius : 3,
        fillColor : 'white',
        lineColor : null,
        lineWidth : 1
      }
    },
    area : {
      fillOpacity : 0.7,
      lineWidth : 2,
      //shadow: true,//是否为曲线加阴影
      marker : {
        symbol : 'circle',
        radius : 3,
        fillColor : 'white',
        lineColor : null,
        lineWidth : 1
      }
    },
    bar : {
      dataLabels : {
        enabled : true
      }
    },
    column : {
    }
  }
}

export const DEFAULT_PIE_OPTIONS = {
  chart: {
    type: 'pie'
  },
  title: {
    text: ''
  },
  tooltip: {
    backgroundColor: 'rgba(41, 55, 69, 0.8)',
    borderColor: '#010202',
    borderRadius: 5,
    shadow: true,
    style: {
      color: '#FFFFFF'
    },
    formatter: function() {
      return '<b>' + this.point.name + '</b>: ' + (this.percentage).toFixed(2) + '%' + '(' + this.y + ')'
    },
    percentageDecimals: 1
  },
  // legend: {
  //   borderWidth: 0,
  //   // layout: 'vertical',<commit_msg>set pie chart legend default enabled to false<commit_after>/**
 * highcharts配置生成辅助方法
 */
import _ from 'lodash'
import * as utils from '../utils'
import Highcharts from 'highcharts'

if (typeof Highcharts === 'undefined') {
  throw new Error(`
    Highcharts has been optimized for npm, see these links for help.
    http://www.highcharts.com/component/content/article/2-news/188-highcharts-optimized-for-npm
    http://www.hcharts.cn/subject/highcharts-4.1.10.php
  `)
}

const COLORS = [
  '#4da1ff', '#f4533c', '#ffae00', '#1aba9b', '#e552b0', '#af6bcb', '#9aab4f', '#6673d1', '#3ebb43',
  '#2c81e1', '#dd4544', '#e49518', '#0c967b', '#bd3998', '#944cb2', '#7b8d43', '#4e5ab0', '#299e2e',
  '#1665bd', '#bd3b47', '#d97707', '#06715d', '#8f2e73', '#7b3499', '#69821c', '#4a498f', '#18851d'
]

Highcharts.setOptions({
  colors: COLORS,
  lang: {
    // TODO 多语言版本以及其它基本配置
    noData: '暂无数据'
  }
})

// 获取分组配置信息，未设置的在默认分组
// {male: ['y0', 'y1'], femail: ['y3']}
function stackParser(config, names) {
  if (!config) return null
  let ret = {}
  let defaultGroupName = 'default'
  _.each(names, (val, key) => {
    ret[key] = defaultGroupName
  })

  _.each(config, (val, key) => {
    _.each(val, (name) => {
      ret[name] = key
    })
  })

  return ret
}

export const DEFAULT_LINE_OPTIONS = {
  chart : {
    backgroundColor : 'rgba(0, 0, 0, 0)'
  },
  title : {
    text : ''
  },
  legend : {
    borderWidth : 0,
    margin : 0,
    maxHeight : 50,
    itemStyle : {
      color : '#636A7C',
      fontWeight : 'normal'
    }
  },
  xAxis : {
    tickmarkPlacement : 1,
    gridLineColor : '#E8EBF2',
    gridLineWidth : 1,
    labels : {
      // x轴旋转角度
      //rotation: 30,
      //限定用多少行来显示轴轴标签自动地的避免某些标签的重叠。设置为1表示禁用重叠检测
      maxStaggerLines : 1,
      //useHTML: true,
      style : {
        fontSize : 12
      }
    }
  },
  tooltip : {
    shared : true,
    valueSuffix : '',
    backgroundColor : 'rgba(41, 55, 69, 0.8)',
    borderColor : '#010202',
    borderRadius : 5,
    shadow : true,
    hideDelay : 10, //提示框隐藏延时。当鼠标移出图标后，数据提示框会在设定的延迟时间后消失。
    style : {
      zIndex : -1,
      color : '#FFFFFF',
      'pointer-events': 'none'
    },
    crosshairs : { //控制十字线
      width : 1,
      color : '#39B54A',
      dashStyle : 'shortdot'
    },
    useHTML : true
  },
  credits : {
    enabled : false
  },
  plotOptions : {
    areaspline : {
      fillOpacity : 0.08,
      lineWidth : 2,
      //shadow: true,//是否为曲线加阴影
      marker : {
        symbol : 'circle',
        radius : 3,
        fillColor : 'white',
        lineColor : null,
        lineWidth : 1
      }
    },
    spline : {
      fillOpacity : 0.08,
      lineWidth : 2,
      //shadow: true,//是否为曲线加阴影
      marker : {
        symbol : 'circle',
        radius : 3,
        fillColor : 'white',
        lineColor : null,
        lineWidth : 1
      }
    },
    area : {
      fillOpacity : 0.7,
      lineWidth : 2,
      //shadow: true,//是否为曲线加阴影
      marker : {
        symbol : 'circle',
        radius : 3,
        fillColor : 'white',
        lineColor : null,
        lineWidth : 1
      }
    },
    bar : {
      dataLabels : {
        enabled : true
      }
    },
    column : {
    }
  }
}

export const DEFAULT_PIE_OPTIONS = {
  chart: {
    type: 'pie'
  },
  title: {
    text: ''
  },
  lengend: {
    enabled: false
  }
  tooltip: {
    backgroundColor: 'rgba(41, 55, 69, 0.8)',
    borderColor: '#010202',
    borderRadius: 5,
    shadow: true,
    style: {
      color: '#FFFFFF'
    },
    formatter: function() {
      return '<b>' + this.point.name + '</b>: ' + (this.percentage).toFixed(2) + '%' + '(' + this.y + ')'
    },
    percentageDecimals: 1
  },
  // legend: {
  //   borderWidth: 0,
  //   // layout: 'vertical',
{'fraction_non_alphanumeric': 0.1687786465354543, 'fraction_numerical': 0.051765974656241574, 'mean_word_length': 2.0695076541166735, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2713022', 'n_tokens_mistral': 3177, 'n_tokens_neox': 3026, 'n_words': 571}