ios – Swift Charts Customize xAxis Label Position?


enter image description hereI can’t seem to find a way to control where the xAxis labels in a Swift Chart are positioned, by default this code results in 2 xAxis labels in the center of the chart (as pictured). I would like to customize this chart to show the date of the first sample on the far left and the date of the last sample on the far right, how can I accomplish this?

Chart {

  ForEach(buildChartRangedBarChartObjectsFrom(workoutStartDate: 
  workoutDetailViewModel.fullyLoadedWorkout?.startDate ?? Date(), workoutEndDate: 
  workoutDetailViewModel.fullyLoadedWorkout?.endDate ?? Date(), 
  customCyclingCadenceObjects: unwrappedCyclingCadenceObjects)) { 
  chartRangedBarChartObject in
      BarMark(
      x: .value("Date", chartRangedBarChartObject.periodStartDate),
      yStart: .value("Minimum Cadence During Minute", 
      chartRangedBarChartObject.minValue),
      yEnd: .value("Maximum Cadence During Minute", 
       chartRangedBarChartObject.maxValue),
       width: MarkDimension(integerLiteral: 5)
                                )
      .foregroundStyle(Color.teal.gradient)
                            }
                        }
      [![enter image description here][1]][1]

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img