title: How to set the X-values to Bar chart view X-axis using Daniel Chart?
body: <p>I have use the Daniel Chart library.I want to show the xAxis value on the simple Bar Graph due to change in new library not able to set xValues,below is the previous code to set the xValues as string in but in the latest code not able to set same.</p>
  
  <p><a href="https://i.stack.imgur.com/bopIS.png" rel="nofollow"><img src="https://i.stack.imgur.com/bopIS.png" alt="enter image description here"></a>
  <strong>Old code:</strong>  Check the last line i.e set the barchartdata with xValues.</p>
  
  <pre><code> - (void)setDataCount:(int)count range:(float)range
  {
  
      NSArray *tempXvals = [self.graphDict valueForKey:@"xVals"];
      NSArray *xvals = [[tempXvals reverseObjectEnumerator]allObjects];
  
      NSMutableArray *xVals;
  
      if ([xvals count]&gt;0) {
          xVals = [[NSMutableArray alloc] initWithArray:xvals];
      }
      else
      {
          xVals = [[NSMutableArray alloc] init];
      }
  
      NSArray *tempYvals = [self.graphDict valueForKey:@"yVals"];
      NSArray *yvals = [[tempYvals reverseObjectEnumerator]allObjects];
      NSMutableArray *yVals = [[NSMutableArray alloc] init];
  
      int xValsCount = [xVals count];
      for (int i = 0; i &lt; xValsCount; i++)
      {
         int val = [[yvals objectAtIndex:i]integerValue];
         [yVals addObject:[[BarChartDataEntry alloc]initWithValue:(val) xIndex:i]];
      }
  
  
      NSString *graphTitle = [self.graphDict valueForKey:@"title"];
      BarChartDataSet *set1;
      if (graphTitle != nil) {
          set1 = [[BarChartDataSet alloc] initWithYVals:yVals label:graphTitle];
      }
      graphTitle = nil;
  
  
      NSMutableArray *dataSets = [[NSMutableArray alloc]init];
      [dataSets addObject:set1];
  
      NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
      formatter.minimumFractionDigits = 0;
  
      BarChartData *data = [[BarChartData alloc] initWithXVals:xVals dataSets:dataSets];
  </code></pre>
  
  <p><strong>New Code :</strong> In new library only datasets use.but how to pass xvalues.</p>
  
  <pre><code>- (void)setDataCount:(int)count range:(double)range
  {
      double start = 1.0;
  
      NSMutableArray *yVals = [[NSMutableArray alloc] init];
  
      for (int i = start; i &lt; start + count + 1; i++)
      {
          double mult = (range + 1);
          double val = (double) (arc4random_uniform(mult));
          [yVals addObject:[[BarChartDataEntry alloc] initWithX:(double)i y:val]];
      }
  
      BarChartDataSet *set1 = nil;
      if (_chartView.data.dataSetCount &gt; 0)
      {
          set1 = (BarChartDataSet *)_chartView.data.dataSets[0];
          set1.values = yVals;
          [_chartView.data notifyDataChanged];
          [_chartView notifyDataSetChanged];
      }
      else
      {
          set1 = [[BarChartDataSet alloc] initWithValues:yVals label:@"The year 2017"];
          [set1 setColors:ChartColorTemplates.material];
  
          NSMutableArray *dataSets = [[NSMutableArray alloc] init];
          [dataSets addObject:set1];
  
          BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets];
          [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]];
  
          data.barWidth = 0.9f;
  
          _chartView.data = data;
      }
  }
  </code></pre>