var myChart11 = echarts.init(document.querySelector(".echart11"))
var option11 = {
  tooltip: {
    trigger: "item",
    show: true,
    showContent: true,
  },

  series: [{
    // name: "Access From",
    type: "pie",
    radius: ["70%", "90%"],
    avoidLabelOverlap: false,
    itemStyle: {
      color: "#3D9DF4",
    },
    label: {
      show: true,
      position: "center",
      color: "#3D9DF4",
    },
    emphasis: {
      label: {
        show: true,
        fontSize: "40",
        fontWeight: "bold",
      },
      itemStyle: {
        shadowBlur: 10,
        shadowOffsetX: 0,
        shadowColor: "rgba(0, 0, 0, 0.5)",
      },
    },
    labelLine: {
      show: false,
    },
    data: [{
      value: 100,
      name: "100%",
      label: {
        position: "center",
        fontSize: 18,
        color: "#3D9DF4",
      },
    }, ],
  }, ],
}







option11 && myChart11.setOption(option11)

var myChart12 = echarts.init(document.querySelector(".echart12"))

//新增租赁住房数量
// $('#lblmubiao3').html(20000);
var taskId3 = "249477757645451264"

var quotaCode3 = "Q250305589481046017"
var url3 =
  "https://sznbs.ningbo.gov.cn:89/nbszhjkzz/tojcms/getQuotaByTaksIdOrQuotaCode.do?parentQuotaCode=" +
  quotaCode3 +
  "&systemName=government"

$.post(url3, function(data) {
  // debugger;
  var d = unique(data.infoList)
    // var mubiao3 = countTotal(d, 'targetValue');
    // var nb_value = countTotal(d, 'currentValue');
    // $('#lblmubiao3').html(mubiao3);
    // $('#lbldangqian3').html(nb_value);
    // var myChart3 = echarts.init(document.getElementById('chart3'));
  var colors = ["#31C563", "#5c8ff8"]
  var option12 = {
    color: colors,
    tooltip: {
      trigger: "axis",
      axisPointer: {
        type: "cross",
      },
    },
    grid: {
      bottom: 39,
      right: 100,
      top: 35,
    },
    // toolbox: {
    //     feature: {
    //         dataView: {show: true, readOnly: false},
    //         restore: {show: true},
    //         saveAsImage: {show: true}
    //     }
    // },
    legend: {
      top: 0,
      left: "center",
      textStyle: {
        fontSize: 16,
        color: "#797979",
      },
    },
    xAxis: [{
      type: "category",
      axisTick: {
        alignWithLabel: true,
      },
      data: d.map(function(item) {
        return ningbo_allareas[item["areaCode"]]
      }),
      axisLabel: {
        rotate: 30,
        fontSize: 16,
      },
    }, ],
    yAxis: [{
        type: "value",
        name: "套",
        min: 0,
        max: 15000,
        position: "left",
        axisTick: {
          show: true,
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: colors[0],
          },
        },
        splitLine: { show: false },
        axisLabel: {
          formatter: "{value} 套",
          fontSize: 16,
        },
        nameTextStyle: {
          color: "#31C563",
          fontSize: 16,
        },
      },
      {
        type: "value",
        name: "套",
        min: 0,
        max: 15000,
        splitLine: { show: false },

        position: "right",
        axisTick: {
          show: true,
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: colors[1],
          },
        },
        axisLabel: {
          formatter: "{value} 套",
          fontSize: 16,
        },
        nameTextStyle: {
          color: colors[1],
          fontSize: 16,
        },
      },
    ],
    series: [{
        name: "完成值",
        type: "bar",
        data: d.map(function(item) {
          return item["currentValue"]
        }),
        barWidth: 15,
      },
      {
        name: "目标值",
        type: "bar",
        yAxisIndex: 1,
        data: d.map(function(item) {
          return item["targetValue"]
        }), //['1932', '645', '0', '0', '373', '0', '1308', '8960', '1235', '0', '266', '2579', '1520', '180', '1002']
        barWidth: 15,
      },
    ],
  }
  myChart12.setOption(option12)
})