title: Core Plot graph bar disappears while scrolling beyond halfway
body: <p>I created a gantt chart using CorePlot's range plot. I added horizontal scrolling and it's working fine, however, every time I scroll horizontally, the graph bar disappears once 50% of is off the screen. Is there a way to fix this?</p>
  
  <p>Here's an example of the chart before scrolling:
  <a href="https://i.stack.imgur.com/2go3j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2go3j.png" alt="Chart before scrolling"></a></p>
  
  <p>The chart after scrolling and the bar disappeared marked in blue.
  <a href="https://i.stack.imgur.com/Yz5iW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yz5iW.png" alt="graph bar disappears"></a></p>
  
  <p>THANKS</p>
  
  <p>EDIT: I Found this this method, but don't know how to make the modification.</p>
  
  <pre><code>-(void)drawRangeInContext:(CGContextRef)context
              lineStyle:(CPTLineStyle *)lineStyle
              viewPoint:(CGPointError *)viewPoint
            halfGapSize:(CGSize)halfGapSize
           halfBarWidth:(CGFloat)halfBarWidth
            alignPoints:(BOOL)alignPoints
  {
      if ( [lineStyle isKindOfClass:[CPTLineStyle class]] &amp;&amp;   !isnan(viewPoint-&gt;x) &amp;&amp; !isnan(viewPoint-&gt;y) ) {
          CPTAlignPointFunction alignmentFunction =     CPTAlignPointToUserSpace;
  
      CGFloat lineWidth = lineStyle.lineWidth;
      if ( ( self.contentsScale &gt; CPTFloat(1.0) ) &amp;&amp; (round(lineWidth) == lineWidth) ) {
          alignmentFunction = CPTAlignIntegralPointToUserSpace;
      }
  
      CGMutablePathRef path = CGPathCreateMutable();
  
      // centre-high
      if ( !isnan(viewPoint-&gt;high) ) {
          CGPoint alignedHighPoint = CPTPointMake(viewPoint-&gt;x, viewPoint-&gt;y + halfGapSize.height);
          CGPoint alignedLowPoint  = CPTPointMake(viewPoint-&gt;x, viewPoint-&gt;high);
          if ( alignPoints ) {
              alignedHighPoint = alignmentFunction(context, alignedHighPoint);
              alignedLowPoint  = alignmentFunction(context, alignedLowPoint);
          }
          CGPathMoveToPoint(path, NULL, alignedHighPoint.x, alignedHighPoint.y);
          CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y);
      }
  
      // centre-low
      if ( !isnan(viewPoint-&gt;low) ) {
          CGPoint alignedHighPoint = CPTPointMake(viewPoint-&gt;x, viewPoint-&gt;y - halfGapSize.height);
          CGPoint alignedLowPoint  = CPTPointMake(viewPoint-&gt;x, viewPoint-&gt;low);
          if ( alignPoints ) {
              alignedHighPoint = alignmentFunction(context, alignedHighPoint);
              alignedLowPoint  = alignmentFunction(context, alignedLowPoint);
          }
          CGPathMoveToPoint(path, NULL, alignedHighPoint.x, alignedHighPoint.y);
          CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y);
      }
  
      // top bar
      if ( !isnan(viewPoint-&gt;high) ) {
          CGPoint alignedHighPoint = CPTPointMake(viewPoint-&gt;x - halfBarWidth, viewPoint-&gt;high);
          CGPoint alignedLowPoint  = CPTPointMake(viewPoint-&gt;x + halfBarWidth, viewPoint-&gt;high);
          if ( alignPoints ) {
              alignedHighPoint = alignmentFunction(context, alignedHighPoint);
              alignedLowPoint  = alignmentFunction(context, alignedLowPoint);
          }
          CGPathMoveToPoint(path, NULL, alignedHighPoint.x, alignedHighPoint.y);
          CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y);
      }
  
      // bottom bar
      if ( !isnan(viewPoint-&gt;low) ) {
          CGPoint alignedHighPoint = CPTPointMake(viewPoint-&gt;x - halfBarWidth, viewPoint-&gt;low);
          CGPoint alignedLowPoint  = CPTPointMake(viewPoint-&gt;x + halfBarWidth, viewPoint-&gt;low);
          if ( alignPoints ) {
              alignedHighPoint = alignmentFunction(context, alignedHighPoint);
              alignedLowPoint  = alignmentFunction(context, alignedLowPoint);
          }
          CGPathMoveToPoint(path, NULL, alignedHighPoint.x, alignedHighPoint.y);
          CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y);
      }
  
      // centre-left
      if ( !isnan(viewPoint-&gt;left) ) {
          CGPoint alignedHighPoint = CPTPointMake(viewPoint-&gt;x - halfGapSize.width, viewPoint-&gt;y);
          CGPoint alignedLowPoint  = CPTPointMake(viewPoint-&gt;left, viewPoint-&gt;y);
          if ( alignPoints ) {
              alignedHighPoint = alignmentFunction(context, alignedHighPoint);
              alignedLowPoint  = alignmentFunction(context, alignedLowPoint);
          }
          CGPathMoveToPoint(path, NULL, alignedHighPoint.x, alignedHighPoint.y);
          CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y);
      }
  
      // centre-right
      if ( !isnan(viewPoint-&gt;right) ) {
          CGPoint alignedHighPoint = CPTPointMake(viewPoint-&gt;x + halfGapSize.width, viewPoint-&gt;y);
          CGPoint alignedLowPoint  = CPTPointMake(viewPoint-&gt;right, viewPoint-&gt;y);
          if ( alignPoints ) {
              alignedHighPoint = alignmentFunction(context, alignedHighPoint);
              alignedLowPoint  = alignmentFunction(context, alignedLowPoint);
          }
          CGPathMoveToPoint(path, NULL, alignedHighPoint.x, alignedHighPoint.y);
          CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y);
      }
  
      // left bar
      if ( !isnan(viewPoint-&gt;left) ) {
          CGPoint alignedHighPoint = CPTPointMake(viewPoint-&gt;left, viewPoint-&gt;y - halfBarWidth);
          CGPoint alignedLowPoint  = CPTPointMake(viewPoint-&gt;left, viewPoint-&gt;y + halfBarWidth);
          if ( alignPoints ) {
              alignedHighPoint = alignmentFunction(context, alignedHighPoint);
              alignedLowPoint  = alignmentFunction(context, alignedLowPoint);
          }
          CGPathMoveToPoint(path, NULL, alignedHighPoint.x, alignedHighPoint.y);
          CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y);
      }
  
      // right bar
      if ( !isnan(viewPoint-&gt;right) ) {
          CGPoint alignedHighPoint = CPTPointMake(viewPoint-&gt;right, viewPoint-&gt;y - halfBarWidth);
          CGPoint alignedLowPoint  = CPTPointMake(viewPoint-&gt;right, viewPoint-&gt;y + halfBarWidth);
          if ( alignPoints ) {
              alignedHighPoint = alignmentFunction(context, alignedHighPoint);
              alignedLowPoint  = alignmentFunction(context, alignedLowPoint);
          }
          CGPathMoveToPoint(path, NULL, alignedHighPoint.x, alignedHighPoint.y);
          CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y);
      }
  
      CGContextBeginPath(context);
      CGContextAddPath(context, path);
      [lineStyle setLineStyleInContext:context];
      [lineStyle strokePathInContext:context];
      CGPathRelease(path);
      }
  }
  </code></pre>