You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ℹ I am using a bar chart and line chart to draw few values. I have 12 months in x-axis but when ran it reduces the count to 6 and showing alternate values.
What did you expect to happen?
ℹ I want to show user full 12 values all the time and zoom user from zooming.
Bar Chart Code
barChartView.noDataText = noDataText
barChartView.chartDescription?.text = ""
//legend
let legend = barChartView.legend
legend.enabled = true
legend.horizontalAlignment = .right
legend.verticalAlignment = .top
legend.orientation = .vertical
legend.drawInside = true
legend.yOffset = 10.0;
legend.xOffset = 10.0;
legend.yEntrySpace = 0.0;
// X - Axis Setup
let xaxis = barChartView.xAxis
self.months = xAxisData
xaxis.valueFormatter = IndexAxisValueFormatter(values: xAxisData)
xaxis.labelPosition = .bottom
xaxis.centerAxisLabelsEnabled = true
xaxis.granularity = 1
xaxis.drawGridLinesEnabled = false
xaxis.enabled = true
xaxis.drawGridLinesEnabled = false
xaxis.drawLabelsEnabled = true
barChartView.rightAxis.enabled = false
// Y - Axis Setup
let yaxis = barChartView.leftAxis
yaxis.spaceTop = 0.35
yaxis.axisMinimum = 0
yaxis.drawGridLinesEnabled = false
//Create data entries here
var dataEntries: [BarChartDataEntry] = []
var dataEntries1: [BarChartDataEntry] = []
for i in 0..<xAxisData.count {
let dataEntry = BarChartDataEntry(x: Double(i) , y: yAxisData1[i])
dataEntries.append(dataEntry)
let dataEntry1 = BarChartDataEntry(x: Double(i) , y: yAxisData2[i])
dataEntries1.append(dataEntry1)
}
let noZeroFormatter = NumberFormatter()
noZeroFormatter.zeroSymbol = ""
noZeroFormatter.numberStyle = .decimal
let chartDataSet = BarChartDataSet(values: dataEntries, label: label1)
chartDataSet.valueFormatter = DefaultValueFormatter(formatter: noZeroFormatter)
let chartDataSet1 = BarChartDataSet(values: dataEntries1, label: label2)
chartDataSet1.valueFormatter = DefaultValueFormatter(formatter: noZeroFormatter)
let dataSets: [BarChartDataSet] = [chartDataSet, chartDataSet1]
chartDataSet.colors = [colorChart1]
chartDataSet1.colors = [colorChart2]
let chartData = BarChartData(dataSets: dataSets)
let groupSpace = 0.4
let barSpace = 0.03
let barWidth = 0.2
chartData.barWidth = barWidth;
chartData.groupBars(fromX: 0.0, groupSpace: groupSpace, barSpace: barSpace)
barChartView.data = chartData
barChartView.xAxis.granularity = 0.5
barChartView.notifyDataSetChanged()
//barChartView.setVisible //setVisibleXRangeMaximum(14)
//chart animation
barChartView.animate(xAxisDuration: 1.5, yAxisDuration: 1.5, easingOption: .linear)
Charts Environment
Charts version/Branch/Commit Number: Latest version Xcode version:10.1 Swift version:4 Platform(s) running Charts: macOS version running Xcode:10.14.2
The text was updated successfully, but these errors were encountered:
What did you do?
ℹ I am using a bar chart and line chart to draw few values. I have 12 months in x-axis but when ran it reduces the count to 6 and showing alternate values.
What did you expect to happen?
ℹ I want to show user full 12 values all the time and zoom user from zooming.
Bar Chart Code
Charts Environment
Charts version/Branch/Commit Number: Latest version
Xcode version:10.1
Swift version:4
Platform(s) running Charts:
macOS version running Xcode:10.14.2
The text was updated successfully, but these errors were encountered: