Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline chart with different amounts of points not working #214

Open
dadixon opened this issue Jul 14, 2022 · 1 comment
Open

Multiline chart with different amounts of points not working #214

dadixon opened this issue Jul 14, 2022 · 1 comment

Comments

@dadixon
Copy link

dadixon commented Jul 14, 2022

I have a multiple line chart working from the demo but the graph I need to create has 1 line with 12 points and another with only 8. When I try this, the shorter graph is stretched and I don't want this behavior. Is that possible?

@dadixon
Copy link
Author

dadixon commented Jul 14, 2022

let data = MultiLineDataSet(dataSets: [
LineDataSet(
dataPoints: [
LineChartDataPoint(value: 4.3, xAxisLabel: "7/13", description: "Saturday, July 9, 00:00 GMT"),
LineChartDataPoint(value: 4.5, xAxisLabel: "F", description: "February"),
LineChartDataPoint(value: 6.9, xAxisLabel: "M", description: "March"),
LineChartDataPoint(value: 8.7, xAxisLabel: "A", description: "April"),
LineChartDataPoint(value: 12.1, xAxisLabel: "M", description: "May"),
LineChartDataPoint(value: 15.1, xAxisLabel: "J", description: "June"),
LineChartDataPoint(value: 17.3, xAxisLabel: "J", description: "July"),
LineChartDataPoint(value: 17.0, xAxisLabel: "A", description: "August"),
LineChartDataPoint(value: 14.3, xAxisLabel: "S", description: "September"),
LineChartDataPoint(value: 10.9, xAxisLabel: "O", description: "October"),
LineChartDataPoint(value: 7.2, xAxisLabel: "N", description: "November"),
LineChartDataPoint(value: 4.7, xAxisLabel: "D", description: "December")
],
legendTitle: "Predictions",
pointStyle: PointStyle(pointType: .outline, pointShape: .circle),
style: LineStyle(lineColour: ColourStyle(colour: .orange), lineType: .line)
),
LineDataSet(
dataPoints: [
LineChartDataPoint(value: 16.9, xAxisLabel: "J", description: "January"),
LineChartDataPoint(value: 17.2, xAxisLabel: "F", description: "February"),
LineChartDataPoint(value: 15.8, xAxisLabel: "M", description: "March"),
LineChartDataPoint(value: 13.7, xAxisLabel: "A", description: "April"),
LineChartDataPoint(value: 11.7, xAxisLabel: "M", description: "May"),
LineChartDataPoint(value: 9.7, xAxisLabel: "J", description: "June"),
LineChartDataPoint(value: 8.9, xAxisLabel: "J", description: "July")
],
legendTitle: "Preliminary",
pointStyle: PointStyle(pointType: .outline, pointShape: .square),
style: LineStyle(lineColour: ColourStyle(colour: .blue), lineType: .line)
)
])

produces

Screen Shot 2022-07-14 at 6 45 32 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant