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

Is there currently a way to ignore 0 for a Line Chart? #42

Open
4bh1nav opened this issue May 18, 2022 · 2 comments
Open

Is there currently a way to ignore 0 for a Line Chart? #42

4bh1nav opened this issue May 18, 2022 · 2 comments

Comments

@4bh1nav
Copy link

4bh1nav commented May 18, 2022

Describe the bug
I couldn't figure out a way presently to ignore 0 on a line in a LineChart. issue that comes up is when you only have one data point with a value, it still draws a line from 0. I believe it should just show a point because the 0 should be ignored.

Screenshot 2022-05-18 at 6 34 21 PM

Screenshot 2022-05-18 at 6 37 23 PM

func makeUIView(context: Context) -> FLChart {
    var  monthsData: [SinglePlotable] {
        [SinglePlotable(name: "M", value: 0),
         SinglePlotable(name: "T", value: 0),
         SinglePlotable(name: "W", value: 55),
         SinglePlotable(name: "T", value: 0),
         SinglePlotable(name: "F", value: 0),
         SinglePlotable(name: "S", value: 0),
         SinglePlotable(name: "S", value: 0)]
    }
    let chartData = FLChartData(title: "Consumptions",
                                data: monthsData,
                                legendKeys: [
                    Key(key: "F1", color: .Gradient.purpleCyan),
                    Key(key: "F2", color: .green),
                    Key(key: "F3", color: .Gradient.sunset)],
                                 unitOfMeasure: "Kg")
    chartData.xAxisUnitOfMeasure = "Days"
    //chartData.yAxisFormatter = .decimal(1)
    
    let lineChart = FLChart(data: chartData, type: .line())
   // let card = FLCard(chart: lineChart, style: .rounded)
    //card.showAverage = true
    //card.showLegend = true
    //lineChart.cartesianPlane.yAxisPosition = .right
    //lineChart.config = FLChartConfig(granularityY: 30)
    return lineChart
}`

`

@francescoleoni98
Copy link
Owner

This is the intended behaviour. Because it is a line chart not a point one like the scatter chart.
Do you have an exemple of how you would like it?

@4bh1nav
Copy link
Author

4bh1nav commented May 18, 2022

I'm looking for something similer like this.

IMG_0257
Screenshot_20220511-141008

Thanks for the reply.

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

2 participants