簡體   English   中英

如何在海圖中刪除額外的系列

[英]how to remove an extra series in highchart

在此處輸入圖片說明

這是我的代碼,在這里沒有顯示任何錯誤,但是圖表始終在此處顯示額外的series4,我無法移動,我檢查了我的數據,這里沒有錯誤兩個,所以我真的不明白這里是數據

LIBGEO  Paris   Marseille   Lyon    Toulouse    Nice    Bordeaux    Strasbourg  Nantes  Montpellier Lille   Aix-en-Provence Rennes  Grenoble    Saint-?tienne   Boulogne-Billancourt
smallsize   107676  19207   16122   11767   10771   8081    7043    6915    6799    6422    5372    4764    4472    4261    4234
middlesize  2926    548 558 444 189 222 223 275 202 205 210 171 102 146 226
largesize   180 20  29  28  9   13  12  14  12  12  4   7   13  5   14

 $(document).ready(function() { var options = { chart: { renderTo: 'container', type: 'column' }, title: { text: 'The number of Different size of company' }, xAxis: { categories: [] }, yAxis: { title: { text: 'Number of company' }, type: 'logarithmic' }, series: [] }; $.get('numenterprise.csv', function(data) { // Split the lines var lines = data.split('\\n'); $.each(lines, function(lineNo, line) { var items = line.split(','); // header line containes categories if (lineNo == 0) { $.each(items, function(itemNo, item) { if (itemNo > 0) options.xAxis.categories.push(item); }); } // the rest of the lines contain data with their name in the first position else { var series = { data: [] }; $.each(items, function(itemNo, item) { if (itemNo == 0) { series.name = item; } else { series.data.push(parseFloat(item)); } }); options.series.push(series); } }); var chart = new Highcharts.Chart(options); }); }); 

如何刪除系列4,我不知道它是怎么出現的!!! 請幫忙

此問題可能是由csv文件末尾的空行引起的。 如果無法編輯csv文件,則可以以編程方式從options.series數組中刪除最后一個系列(在創建圖表之前):

options.series.splice(-1,1);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM