2017-06-02 6 views
1

Ich habe einen Kreisdiagramm Download von High-Charts platziert, aber ich habe einige Probleme, die ich wollte, um den Text kommen von der Tortendiagramm entfernt kann jemand helfen mir aus und lassen Sie mich wissen, wie ist das möglichEntfernen Kreisdiagramm Outline-Text

var colors = Highcharts.getOptions().colors, 
    categories = ['MSIE', 'Firefox', 'Chrome', 'Safari', 'Opera'], 
    data = [{ 
     //y: 56.33, 
     color: colors[0], 
     drilldown: { 
      name: 'MSIE versions', 
      categories: ['General Public (Local)'], 
      data: [<?php echo $company_details[0]['individual']; ?>], 
      color: colors[0] 
     } 
    }, { 
     //y: 10.38, 
     color: colors[1], 
     drilldown: { 
      name: 'Firefox versions', 
      categories: ['Foreign (Ind. & Inst.)'], 
      data: [<?php echo $company_details[0]['foreign']; ?>], 
      color: colors[1] 
     } 
    }, { 
     //y: 24.03, 
     color: colors[2], 
     drilldown: { 
      name: 'Chrome versions', 
      categories: ['Institutional'], 
      data: [<?php echo $company_details[0]['institutions']; ?>], 
      color: colors[2] 
     } 
    }, { 
     //y: 4.77, 
     color: colors[3], 
     drilldown: { 
      name: 'Safari versions', 
      categories: ['Directors/Spouses'], 
      data: [<?php echo $sum_all_details; ?>], 
      color: colors[3] 
     } 
    }, { 
     // y: 0.2, 
     color: colors[5], 
     drilldown: { 
      name: 'Proprietary or Undetectable', 
      categories: [], 
      data: [], 
      color: colors[5] 
     } 
    }], 
    browserData = [], 
    versionsData = [], 
    i, 
    j, 
    dataLen = data.length, 
    drillDataLen, 
    brightness; 

// Build the data arrays 
for (i = 0; i < dataLen; i += 1) { 
// add browser data 
browserData.push({ 
    name: categories[i], 
    y: data[i].y, 
    color: data[i].color 
}); 

// add version data 
drillDataLen = data[i].drilldown.data.length; 
for (j = 0; j < drillDataLen; j += 1) { 
    brightness = 0.2 - (j/drillDataLen)/5; 
    versionsData.push({ 
     name: data[i].drilldown.categories[j], 
     y: data[i].drilldown.data[j], 
     color: Highcharts.Color(data[i].color).brighten(brightness).get() 
    }); 
} 
} 

// Create the chart 
Highcharts.chart('container', { 
    chart: { 
     type: 'pie' 
    }, 
    yAxis: { 
     title: { 
      text: 'Total percent market share' 
     } 
    }, 
    plotOptions: { 
     pie: { 
      shadow: false, 
      center: ['50%', '50%'] 
     }, 
     dataLabels: { 
      enabled: false 
     } 
    }, 
    tooltip: { 
     valueSuffix: '%' 
    }, 
    series: [{ 
     name: 'Browsers', 
     data: browserData, 
     size: '30%', 
     dataLabels: { 
      formatter: function() { 
       return this.y > 5 ? this.point.name : null; 
      }, 
      color: '#ffffff', 
      distance: -30 
     } 
    }, { 
     name: 'Versions', 
     data: versionsData, 
     size: '90%', 
     innerSize: '40%', 
     dataLabels: { 
      formatter: function() { 
       // display only if larger than 1 
       return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + 
        this.y + '%' : null; 
      } 
     }, 
     id: 'versions' 
    }], 
    responsive: { 
     rules: [{ 
      condition: { 
       maxWidth: 250 
      }, 
      chartOptions: { 
       series: [{ 
        id: 'versions', 
        dataLabels: { 
         enabled: false 
        } 
       }] 
      } 
     }] 
    } 
    }); 

ich bin nicht in der Lage, um herauszufinden, wie kann ich den Text entfernen, die in der umrandete Bereich zeigt der Text sichtbar out-Bereich des Diagramms kann mir jemand helfen enter image description here

+0

Hilft Ihnen meine Antwort? Wenn ja, dann akzeptiere die Antwort. – ali

Antwort

4

Sie dataLabels Eigenschaft gesetzt haben unter PlotOptions aber sollte es unter Kuchenobjekt sein. Ihr Code

plotOptions: { 
    pie: { 
     shadow: false, 
     center: ['50%', '50%'] 
    }, 
    dataLabels: { 
     enabled: false 
    } 
} 

Platz dataLabels unter pie von plotOptions, Beispielcode unten:

plotOptions: { 
    pie: { 
     shadow: false, 
     center: ['50%', '50%'] 
     dataLabels: { 
      enabled: false 
     } 
    } 
} 

jsFiddle Link Referenz.