Skip to content

Commit

Permalink
Merge pull request #66 from mkubenka/limit-line-xaxis
Browse files Browse the repository at this point in the history
Fix x-axis limit line render issue + x-limit-line example
  • Loading branch information
danielgindi committed May 5, 2015
2 parents 933f4b2 + a6baa45 commit 2cdd9ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Charts/Classes/Renderers/ChartXAxisRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public class ChartXAxisRenderer: ChartAxisRendererBase

_limitLineSegmentsBuffer[0].x = position.x;
_limitLineSegmentsBuffer[0].y = viewPortHandler.contentTop;
_limitLineSegmentsBuffer[1].x = position.y;
_limitLineSegmentsBuffer[1].x = position.x;
_limitLineSegmentsBuffer[1].y = viewPortHandler.contentBottom;

CGContextSetStrokeColorWithColor(context, l.lineColor.CGColor);
Expand Down
9 changes: 9 additions & 0 deletions ChartsDemo/Classes/Demos/LineChart1ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ - (void)viewDidLoad
_chartView.pinchZoomEnabled = YES;
_chartView.highlightIndicatorEnabled = NO;

// x-axis limit line
ChartLimitLine *llXAxis = [[ChartLimitLine alloc] initWithLimit:10.f label:@"Index 10"];
llXAxis.lineWidth = 4.f;
llXAxis.lineDashLengths = @[@(10.f), @(10.f), @(0.f)];
llXAxis.labelPosition = ChartLimitLabelPositionRight;
llXAxis.valueFont = [UIFont systemFontOfSize:10.f];

[_chartView.xAxis addLimitLine:llXAxis];

ChartLimitLine *ll1 = [[ChartLimitLine alloc] initWithLimit:130.f label:@"Upper Limit"];
ll1.lineWidth = 4.f;
ll1.lineDashLengths = @[@5.f, @5.f];
Expand Down

0 comments on commit 2cdd9ee

Please sign in to comment.