- function test(obj, marker) {
- const markDown = document.createElement('div');
- markDown.id = marker + '31';
- markDown.innerHTML =
- `
- <div style="z-index: 1200;margin-left: 9px;margin-top:54px;" >
- <div class="sign" id="` + marker + `2" style="display: absolute;">
- <div style="display: absolute;height: 20px;background: rgb(0,0,0);opacity: .9;text-align: center;cursor: pointer;border-top: 3px solid #ff924a;">
- <span style="margin:0px 1px 0px 1px;height: 20px;font-size: 13px;font-family: Consolas Bold,PingFangSC-Regular,PingFang SC,sans-serif;font-weight: 700;opacity:.9;color: #fff;line-height: 20px;padding: 0 5px;">XXX1号农场</span>
- </div>
- </div>
- </div>
- <div style="position:absolute;z-index: 9999;margin-left:-310px;margin-right:80px;margin-top:-100px;font-family: Consolas Bold,PingFangSC-Regular,PingFang SC,sans-serif;">
- <div class="sign" id="` + marker + `" style="display: absolute;font-size: 12px; text-align: left; background-image: linear-gradient(90deg, rgba(0,8,74,0.9), rgba(0,8,74,0.7));
- border-radius: 8px; color: rgb(238, 238, 238); z-index: 9999; border: 1px solid #45f1ff;display: block; visibility: visible;">
- <div style="margin: 5px 0px 5px 0px;line-height: 30px;overflow: hidden;">
- <div style="margin:0 auto; ">
- <div style="display:inline-block;position:absolute;">
- <span id = 'sp' style="margin: 0px 10px -15px 20px;font-size:18px;display:block;">`+ obj.userData.省市 + `</span>
- <span id = 'sp' style="margin: 5px 10px 10px 20px;line-height:40px">`+ obj.userData.详细地址 + `</span>
- </div>
- <div style="display:inline-block;">
- <span id = 'sp' style="margin: 0px 20px 10px 180px;display:inline-block;bottom:7px;line-height:42px;font-size:13px;">主营:鸡蛋,半成品</span>
- </div>
- </div>
- <hr style="width: 92%;margin-bottom:5px;" color="#0078a9" >
- <div>
- <div style="display:inline-block;position:absolute;">
- <span id = 'sp' style="margin: 25px 10px 0px 20px;bottom: 10px;font-size: 18px;">累计采购量</span>
- </div>
- <div style="display:inline-block;">
- <span id = 'sp' style="margin: 5px 0px 0px 250px;font-size:24px;">36</span>
- </div>
- <div style="display:inline-block;">
- <span id = 'sp' style="margin: 0px 10px 0px 0px;font-size: 13px;color:#00c0f2">单</span>
- </div>
- <div>
- <div style="">
- <div style="margin: 0px 20px 20px 20px;border: 1px solid rgba(0,36,96,0.9);border-radius: 5px;">
- <div id="` + marker + `99" style="height: 100px;"></div>
- </div>
- </div>
- </div>
- </div>
- <div style="display: absolute;border-width: 10px;bottom: 71.5%;border-color: transparent;border-left-color: #45f1ff;opacity:.8;border-style: solid; position: absolute;display: block;
- width: 0;height: 0;left: 103%;transform: translate(-50%,0);background: transparent; ">
- </div>
- <div style="display: absolute;border-width: 10px;bottom: 71.5%;border-color: transparent;border-left-color: rgba(0,8,74,0.7);border-style: solid; position: absolute;display: block;
- width: 0;height: 0;left: 102%;transform: translate(-50%,0);background: transparent; ">
- </div>
- <div></div>
- </div>
- </div>
- </div>
- `
- $('div2d').append(markDown)
- var uiAnchor1 = app.create({
- type: 'Marker',
- alwaysOnTop: true,
- keepSize: true,
- size: 0.95,
- inheritScale: false,
- parent: obj,
- element: markDown,
- localPosition: [0, 0, 0],
- complete: function () {
- setTimeout(function () {
- createEcharts(marker)
- $('#' + marker + '31').css('pointer-events', 'none')
- }, 100)
- }
- });
- }
- /**
- * 创建供应商弹窗中的Echarts图表,并添加到弹窗中
- */
- function createEcharts(marker) {
- let mm = marker + '99'
- var myChart = window.echarts.init(document.getElementById(mm));
- // 绘制图表
- var option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- lineStyle: {
- color: '#57617B'
- }
- }
- },
- legend: {
- show: false
- },
- grid: {
- left: '0%',
- right: '0%',
- bottom: '0%',
- top: '0%',
- containLabel: true
- },
- xAxis: [{
- type: 'category',
- boundaryGap: false,
- axisLine: {
- lineStyle: {
- color: '#354564'
- }
- },
- axisTick: {
- show: false
- },
- axisLabel: {
- margin: 10,
- textStyle: {
- fontSize: 12,
- color: "#9aa2b2",
- padding: [-5, 0, 0, 0]
- }
- },
- splitLine: {
- lineStyle: {
- color: '#354564'
- }
- },
- data: ['', '12', '13', '14', '15', '16', '17', '18', '']
- }],
- yAxis: [{
- type: 'value',
- min: 0,
- max: 15,
- splitNumber: 6,
- axisTick: {
- show: false
- },
- axisLine: {
- lineStyle: {
- color: '#354564'
- }
- },
- axisLabel: {
- show: false,
- margin: 10,
- textStyle: {
- fontSize: 14,
- color: "#9aa2b2"
- }
- },
- splitLine: {
- lineStyle: {
- color: '#354564'
- }
- }
- }],
- series: [{
- name: '鸡蛋',
- type: 'line',
- smooth: true,
- symbol: 'circle',
- symbolSize: 5,
- showSymbol: false,
- lineStyle: {
- normal: {
- width: 3
- }
- },
- areaStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
- offset: 0,
- color: 'rgb(113,92,41, 0.6)'
- }, {
- offset: 0.8,
- color: 'rgba(137, 189, 27, 0)'
- }], false),
- shadowColor: 'rgba(0, 0, 0, 0.1)',
- shadowBlur: 10
- }
- },
- itemStyle: {
- normal: {
- color: '#eeae17',
- borderColor: 'rgba(137,189,2,0.27)',
- borderWidth: 12
- }
- },
- data: [6.4, 7.0, 5.4, 6.0, 6.5, 8.8, 7.0, 8.0, 7.0, 6.0, 7.0]
- }, {
- name: '半成品',
- type: 'line',
- smooth: true,
- symbol: 'circle',
- symbolSize: 5,
- showSymbol: false,
- lineStyle: {
- normal: {
- width: 3
- }
- },
- areaStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
- offset: 0,
- color: '#0dacb5'
- }, {
- offset: 1,
- color: 'rgba(0, 136, 212, 0)'
- }], false),
- shadowColor: 'rgba(0, 0, 0, 0.1)',
- shadowBlur: 10
- }
- },
- itemStyle: {
- normal: {
- color: '#05e3ec',
- borderColor: 'rgba(0,136,212,0.2)',
- borderWidth: 12
- }
- },
- data: [2.4, 1.9, 3.9, 2.0, 1.0, 3.0, 2.5, 2.8, 2.0, 3.0, 2.8]
- }]
- };
- myChart.setOption(option)
- }
复制代码 以上是一个简单的dom元素中插入了echarts图表的示例,可供参考
|
|