Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9199517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:33:03+00:00 2026-06-17T22:33:03+00:00

I have following generated JavaScript-Code to display a chart with HighCharts: <script type=text/javascript> var

  • 0

I have following generated JavaScript-Code to display a chart with HighCharts:

<script type="text/javascript">

var highchartsOptions   = Highcharts.setOptions(Highcharts.theme);
var TaskChart; // Chart-Objekt    
var TaskDuration          = new Array();    
// Save starting points to javascript variables for HighCharts
var startingUTC = 1288102643364;
TaskDuration =  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,206,216,216,206,206];
for(var i = 0; i < TaskDuration.length; i++) {
    if(TaskDuration[i] == 0) {
        TaskDuration[i] = null;
    }
}
</script>
<script type="text/javascript">
$j(document).ready(function() { 
    TaskChart = new Highcharts.Chart({
    credits: {
            enabled: false
    },
    chart: {
      renderTo: "chart01",
      defaultSeriesType: 'area',
      zoomType: 'x',
      spacingBottom: 250
    },
    title: {
      text: "Task Duration"
    },
    xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
            week: '%e. %b %Y'   
        },
        offset: 10,
        startOnTick: true,
        maxZoom: 7 * 24 * 3600000 // seven days
    },
    yAxis: {
      title: {
        text: "Duration"
      }
    },
    tooltip: {
        formatter: function() {
            return '<b>'+ this.series.name +'</b><br/>';            
        }
    },
    plotOptions: {
        area: { 
           stacking: 'normal',
           lineColor: '#666666',
           lineWidth: 1,
           marker: {
              lineWidth: 1,
              lineColor: '#666666'
           }
        }
     },
    series: [
    {
        name: 'Duration',
        pointStart: startingUTC,
        pointInterval: 24*60*60*1000, 
        data: TaskDuration
    }]
  });
});
</script>

The problem is now that I want to remove all the “0” values from the beginning of the TaskDuration series array.

I try to set the values in the array to ‘null’:

for(var i = 0; i < TaskDuration.length; i++) {
    if(TaskDuration[i] == 0) {
        TaskDuration[i] = null;
    }
}

But Highcharts still display the values in the chart.

How to prevent this behavior?

I also try to remove all values from the array until a value which is not “0”. But with this approach the “startingUTC” is wrong. Maybe I have also to recalculate this value…

Regards,
Sandro

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:33:04+00:00Added an answer on June 17, 2026 at 10:33 pm

    You need to remove elements not to set null, use this to remove zero element from array:

    var myArray=[];
    
    for(var i = 0; i < TaskDuration.length; i++) {
        if(TaskDuration[i] != 0) {
           myArray.push(TaskDuration[i]);
        }
    }
    

    working JSfiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that implements 2 jQuery sliders : <script type=text/javascript> $(document).ready(function
I am new to JavaScript/jQuery. I have the following HTML code that's automatically generated
I have the following javascript method: function 123_test_function(){ } The function is generated by
i have the following code: /** * @generated */ public class foo ... /**
I have the following HTML generated by an ASP.NET repeater: <table> <tr> <td><input type=hidden
I have the following type in wsdl (it is generated by third party tool):
I have the following HTML code (note no closing tags on <\option> ) generated
I have generated a pdf file with password protection by using the following code:
I have the following javascript code, which is doing an image rotation on a
I have the following html generated through my PHP code. What I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.