Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 需要在highchart的中心显示离子幻灯片_Angular_Highcharts_Ionic2 - Fatal编程技术网

Angular 需要在highchart的中心显示离子幻灯片

Angular 需要在highchart的中心显示离子幻灯片,angular,highcharts,ionic2,Angular,Highcharts,Ionic2,这是我的代码,我正在尝试创建饼图,在加载视图后,我想在饼图的中心设置一个离子幻灯片。 还希望通过highchart的位置动态显示一些html元素 我已经附上了图片,其中有一些html元素围绕着我想要放置的图形圆圈。我以前在ionic1中做过,但无法调用ionic2中的函数 离子2代码 import { Component } from '@angular/core'; import { NavController, NavParams } from 'ionic-angular'; impor

这是我的代码,我正在尝试创建饼图,在加载视图后,我想在饼图的中心设置一个离子幻灯片。 还希望通过highchart的位置动态显示一些html元素

我已经附上了图片,其中有一些html元素围绕着我想要放置的图形圆圈。我以前在ionic1中做过,但无法调用ionic2中的函数

离子2代码

import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import * as Highcharts from 'highcharts';
import * as HighchartsMore from 'highcharts/highcharts-more';
import * as $ from 'jquery';



HighchartsMore(Highcharts);

@Component({
  selector: 'page-challengedash',
  templateUrl: 'challengedash.html',
  styles: [`
    chart {
        display: block;
        width: auto; // tell the chart to fill 100% of the height of the 'c' container
    }
`]
})
export class ChallengedashPage {



  constructor(public navCtrl: NavController) {




    /*high chart options*/
    this.chart1 = {
      chart: {
        type: 'pie',
        backgroundColor:'',
      },
      credits: {
        enabled: false
      },
      title : '',
      exporting: {
        enabled: false
      },
      plotOptions: {
        pie: {
          shadow: false,
          center: ['50%', '50%']
        }
      },
      tooltip: {
        enabled: false,
        valueSuffix: '%'
      },
      series: [{
        data: [14,14],
        size: '100%',
        innerSize: '95%',
        colors: ['#ff3300', 'rgba(255, 51, 0, 0.2)'],
        borderColor: '',
        borderRadius: 0,
        borderWidth: 0,
        animation: false,
        enableMouseTracking:false,
        dataLabels: {
          enabled: false,
          style: {
            fontWeight: 'bold'
          }
        }
      },
        {
          data: [21,7],
          size: '82%',
          innerSize: '95%',
          colors: ['#00ccff', 'rgba(0, 204, 255, 0.2)'],
          borderColor: '',
          borderRadius: 0,
          borderWidth: 0,
          animation: false,
          shadow: false,
          enableMouseTracking:false,
          dataLabels: {
            enabled: false,
            style: {
              fontWeight: 'bold'
            }
          }
        }]
    };
 };


  chart1: Object;

    ionViewDidEnter() {

           var chart1 = $('.highchart_container');

           var textX1 = chart1.plotLeft + (chart1.plotWidth  * 0.5);
           var textY1 = chart1.plotTop  + (chart1.plotHeight * 0.5);

           var span = $('.container1 div.pieChartInfoText');
           span.css('left', textX1 + (span.width() * -0.5));
           span.css('top', textY1 + (span.height() * -0.5));

           var spantop = $('.container1 div.pieChartInfotop');
           spantop.css('left', textX1 + (spantop.width() * 0));
           spantop.css('top', textY1 + (spantop.height() * -4.65));

           var spanright = $('.container1 div.pieChartInforight');
           spanright.css('left', textX1 + (spanright.width() * 3.7));
           spanright.css('top', textY1 + (spanright.height() * 0));

           var spanrighttext = $('.container1 div.pieChartInforighttext');
           spanrighttext.css('left', textX1 + (spanrighttext.width() * 2.5));
           spanrighttext.css('top', textY1 + (spanrighttext.height() * -0.45));

           var spanbottom = $('.container1 div.pieChartInfobottom');
           spanbottom.css('left', textX1 + (spanbottom.width() * 0));
           spanbottom.css('top', textY1 + (spanbottom.height() * 3.69));

           var spanleft = $('.container1 div.pieChartInfoleft');
           spanleft.css('left', textX1 + (spanleft.width() * -4.7));
           spanleft.css('top', textY1 + (spanleft.height() * 0));

           var spanlefttext = $('.container1 div.pieChartInfolefttext');
           spanlefttext.css('left', textX1 + (spanlefttext.width() * -3.5));
           spanlefttext.css('top', textY1 + (spanlefttext.height() * -0.45));

           var spanrightinfobar = $('.container1 div.pieChartInfoBar');
           spanrightinfobar.css('left', textX1 + (spanrightinfobar.width() * 4.3));
           spanrightinfobar.css('top', textY1 + (spanrightinfobar.height() * -5.5));

           var spanrightsocial = $('.container1 div.pieChartSocialImage');
           spanrightsocial.css('left', textX1 + (spanrightsocial.width() * 2.48));
           spanrightsocial.css('top', textY1 + (spanrightsocial.height() * -2.41));

           var spancurrentday = $('.container1 div.pieChartInfocurrentdaytext');
           spancurrentday.css('left', textX1 + (spancurrentday.width() * -0.5));
           spancurrentday.css('top', textY1 + (spancurrentday.height() * 5.3));

           var spanrighttext0 = $('.background-overlay-trans div.pieChartInforighttext');
           spanrighttext0.css('left', textX1 + (spanrighttext0.width() * 0.42));
           spanrighttext0.css('top', textY1 + (spanrighttext0.height() * 0.45));

           var spanlefttext0 = $('.background-overlay-trans div.pieChartInfolefttext');
           spanlefttext0.css('left', textX1 + (spanlefttext0.width() * -1.31));
           spanlefttext0.css('top', textY1 + (spanlefttext0.height() * 5.12));
  }
}
---------这里更新了代码------------------- ionic1代码,我使用下面的代码实现了这一点

function initialize() {

        categories = [],
        data = [{
            drilldown: {
                name: 'Days',
                categories: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],
                data: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],

            }
            }],
        browserData = [10,18];
        versionsData = [21,7];

    // Create the chart
    var chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'pie',
                backgroundColor:'',
                events: {
                        load: function (event)
                        {
                            var slidebottom = $('#bottom-swipe-box');
                            topswipebox = $('.top-swipe-box');
                            headercustomdash = $('.header-custom-dash div.row');
                            slidebottom.css('top',topswipebox.outerHeight()+headercustomdash.height());
                    }
                },    
            },
            credits: {
                  enabled: false
              },
            title : '',
            exporting: { 
                enabled: false 
            },
            plotOptions: {
                pie: {
                    shadow: false,
                    center: ['50%', '50%']
                }
            },
            tooltip: {
                enabled: false,
                valueSuffix: '%'
            },
            series: [{
                data: browserData,
                size: '100%',
                innerSize: '95%',
                colors: ['#ff3300', 'rgba(255, 51, 0, 0.2)'],
                borderColor: '',
                borderRadius: 0,
                borderWidth: 0,
                animation: false,
                enableMouseTracking:false,
                dataLabels: {
                    enabled: false,
                    style: {
                        fontWeight: 'bold'
                    }
                }
            },
             {
                data: versionsData,
                size: '82%',
                innerSize: '95%',
                colors: ['#00ccff', 'rgba(0, 204, 255, 0.2)'],
                borderColor: '',
                borderRadius: 0,
                borderWidth: 0,
                animation: false,
                shadow: false,
                enableMouseTracking:false,
                dataLabels: {
                    enabled: false,
                    style: {
                        fontWeight: 'bold'
                    }
                }
            },
            {
                data: versionsData,
                size: '78%',
                innerSize: '0%',
                colors: ['rgba(1, 180, 212, 0.2)'],
                borderColor: '',
                borderRadius: 0,
                borderWidth: 0,
                animation: false,
                shadow: false,
                enableMouseTracking:false,
                dataLabels: {
                    enabled: false,
                    style: {
                        fontWeight: 'bold'
                    }
                }
            }]
        },
        function(chart) { // on complete
            var textX = chart.plotLeft + (chart.plotWidth  * 0.5);
            var textY = chart.plotTop  + (chart.plotHeight * 0.5);


            span0 = $('.container0 div.pieChartInfoText');
            span0.css('left', textX + (span0.width() * -0.5));
            span0.css('top', textY + (span0.height() * -0.5));

            spantop0 = $('.container0 div.pieChartInfotop');
            spantop0.css('left', textX + (spantop0.width() * 0));
            spantop0.css('top', textY + (spantop0.height() * -4.65));

            spanright0 = $('.container0 div.pieChartInforight');
            spanright0.css('left', textX + (spanright0.width() * 3.7));
            spanright0.css('top', textY + (spanright0.height() * 0));

            spanrighttext0 = $('.container0 div.pieChartInforighttext');
            spanrighttext0.css('left', textX + (spanrighttext0.width() * 2.5));
            spanrighttext0.css('top', textY + (spanrighttext0.height() * -0.45));

            spanbottom0 = $('.container0 div.pieChartInfobottom');
            spanbottom0.css('left', textX + (spanbottom0.width() * 0));
            spanbottom0.css('top', textY + (spanbottom0.height() * 3.69));

            spanleft0 = $('.container0 div.pieChartInfoleft');
            spanleft0.css('left', textX + (spanleft0.width() * -4.7));
            spanleft0.css('top', textY + (spanleft0.height() * 0));

            spanlefttext0 = $('.container0 div.pieChartInfolefttext');
            spanlefttext0.css('left', textX + (spanlefttext0.width() * -3.5));
            spanlefttext0.css('top', textY + (spanlefttext0.height() * -0.45));

            spanrightinfobar0 = $('.container0 div.pieChartInfoBar');
            spanrightinfobar0.css('left', textX + (spanrightinfobar0.width() * 4.3));
            spanrightinfobar0.css('top', textY + (spanrightinfobar0.height() * -5.5));

            spanrightsocial0 = $('.container0 div.pieChartSocialImage');
            spanrightsocial0.css('left', textX + (spanrightsocial0.width() * 2.48));
            spanrightsocial0.css('top', textY + (spanrightsocial0.height() * -2.41));

            spancurrentday0 = $('.container0 div.pieChartInfocurrentdaytext');
            spancurrentday0.css('left', textX + (spancurrentday0.width() * 1.8));
            spancurrentday0.css('top', textY + (spancurrentday0.height() * 3.3));

            var heights = $("div.slider_box_bottom").map(function ()
            {
                return $(this).height();
            }).get(),
                maxHeight = Math.max.apply(null, heights);
            $("div.slider_box_bottom").css('height',maxHeight);

        });
pieChartInfo。。。。。有太多的类是html元素,我没有把它们放在代码bcz中,因为它们太多了


我主要想让ionic2完成这项工作,如果我把ionic1的代码放在show位置,那么ionic2和ionic1的工作就是这样的

你能澄清一点吗?我可以看到你使用了一个饼图,所以你想在圆的周围放置一些自定义元素?是的,比如圆上的灰色元素…我的意思是…我以前用ionic1做过这件事。你能给我们看看这段代码吗?这样我们就有了一些伪代码,或者它与
ionic2
代码一样,只是不起作用?期望的结果是什么?(或者如果图像是期望的结果,那么当前的结果是什么?)因为这有点不清楚当前我得到的是红色和蓝色的两个圆圈…不是线条,由于我在ionic2中使用了IonicViewDiCenter函数,但该函数不起作用……而在ionic中,我在图表结束后的同一个highchart中使用了该代码。我仍然不确定您的要求是什么-如果您想渲染圆圈周围的灰色勾号-您可以使用位于内圈和外圈之间的渲染路径-如