title: IOS charts with different X,Y values in iOS?
body: <p>I had an iPhone application in which i have to calculate the values for x axis and y axis with some intervals as xaxis array and Yaxis array
  I had fixed values.</p>
  
  <blockquote>
    <p>Then i need to draw 3 line graph with their on x values and Y
    values.then i need to plot scatter points on that graph itself with
    different (x,y) coordinates.</p>
    
    <p>I am using IOs charts library.But when giving different x values to
    the line graph the X axis values are also changing, I am trying in
    this way</p>
  </blockquote>
  
  <pre><code>`  chartview.descriptionText = @"";
      chartview.noDataTextDescription = @"You need to provide data for the chart.";
  
      chartview.drawGridBackgroundEnabled = NO;
      chartview.drawBarShadowEnabled = NO;
      chartview.highlightFullBarEnabled = NO;
      chartview.rightAxis.enabled=NO;
  
  
      chartview.drawOrder = @[@(CombinedChartDrawOrderLine),
                              @(CombinedChartDrawOrderScatter),
                              ];
  
      ChartLegend *l = chartview.legend;
      l.enabled = false;
      //chartview.xAxisRenderer
  
      ChartYAxis *leftAxis = chartview.leftAxis;
      leftAxis.axisLineWidth=2.0f;
  
      leftAxis.axisLineColor =[UIColor whiteColor];
      leftAxis.drawGridLinesEnabled = YES;
      leftAxis.gridColor=[UIColor whiteColor];
      leftAxis.gridLineDashLengths = @[@5.f, @5.f];
      NSLog(@"%@",yaxispoints);
      NSLog(@"%f",[[yaxispoints firstObject] floatValue]);
        NSLog(@"%f",[[yaxispoints lastObject] floatValue]);
      leftAxis.axisMinimum = [[yaxispoints firstObject] floatValue]; // this replaces startAtZero = YES
      leftAxis.axisMaximum = [[yaxispoints lastObject] floatValue];
  
      leftAxis.labelCount = [yaxispoints count];
      leftAxis.spaceTop = 40.0;
      leftAxis.labelTextColor=[UIColor whiteColor];
  
      ChartXAxis *xAxis = chartview.xAxis;
      [xAxis setDrawAxisLineEnabled:YES];
      xAxis.axisLineWidth=2.0f;
      xAxis.granularityEnabled=YES;
  
      xAxis.axisLineColor =[UIColor whiteColor];
      xAxis.labelPosition = XAxisLabelPositionBottom;
      xAxis.axisMinimum = [[months firstObject] floatValue]; // this replaces startAtZero = YES
      xAxis.axisMaximum = [[months lastObject] floatValue];
      xAxis.labelCount = [months count];
  
      xAxis.forceLabelsEnabled=YES;
      xAxis.drawGridLinesEnabled = YES;
      xAxis.gridColor=[UIColor whiteColor];
  
      xAxis.gridLineDashLengths = @[@5.f, @5.f];
      xAxis.valueFormatter = self;
      xAxis.labelTextColor=[UIColor whiteColor];
      [self updateChartData];
      [chartview animateWithXAxisDuration:1.5 yAxisDuration:1.5];`
  
  
    - (void)updateChartData
  {
  
  
      [self setChartData];
  
  }
  
  - (void)setChartData
  {
      CombinedChartData *data = [[CombinedChartData alloc] init];
      data.lineData = [self generateLineData];
  
     data.scatterData = [self generateScatterData];
     chartview.xAxis.axisMaximum = data.xMax + 5.0;
  
      chartview.data = data;
  
  }
  
  - (LineChartData *)generateLineData
  {
      LineChartData *d = [[LineChartData alloc] init];
  
      NSMutableArray *entries = [[NSMutableArray alloc] init];
     NSArray *scxaxis = @[@"55.987", @"75.976", @"85.976"
                            ];
    NSArray *scyaxis = @[@"85.987", @"25.976", @"95.976"
                            ];
  
      for (int index = 0; index &lt; [scxaxis count]; index++)
      {
          [entries addObject:[[ChartDataEntry alloc] initWithX:[[scxaxis objectAtIndex:index] doubleValue] y:[[scyaxis objectAtIndex:index] doubleValue]]];
      }
  
      LineChartDataSet *set = [[LineChartDataSet alloc] initWithValues:entries label:@"Line DataSet"];
      [set setColor:[UIColor greenColor]];
      set.lineWidth = 3.0;
     // [set setCircleColor:[UIColor redColor]];
      //set.circleRadius = 0.0;
     // set.circleHoleRadius = 0.0;
      set .drawCirclesEnabled=NO;
      set.fillColor = [UIColor clearColor];
      set.mode = LineChartModeLinear;
      set.drawValuesEnabled = NO;
  
      set.valueFont = [UIFont systemFontOfSize:14.f];
      set.valueTextColor = [UIColor whiteColor];
  
      set.axisDependency = AxisDependencyLeft;
  
      [d addDataSet:set];
  
      return d;
  }
  </code></pre>
  
  <p>I am trying like this,But when giving different x values to each data set in line graph the x axis is completely going wrong according to it. i want the x axis to be fetched from different array and x,y points of line graph to be from different array, Can anybody help me on achieving this ?</p>