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

no data available #585

Closed
vigyanhoon opened this issue Dec 2, 2015 · 4 comments
Closed

no data available #585

vigyanhoon opened this issue Dec 2, 2015 · 4 comments

Comments

@vigyanhoon
Copy link

Can we hide grid lines, x values etc. when data is not available to the chart? If yes, is there a configuration available or will need to modify code?

screen shot 2015-12-02 at 7 21 31 pm

@liuxuan30
Copy link
Member

well, by default, it it's the first time you load the chart, it will not draw anything. Do you take some actions, like filtering the data leads to no data?
What's your data looks like? how many x values and y vlaues?
You can take a look at the 'data' setter. It should not draw the grid line.

        set
        {
            if (newValue == nil || newValue?.yValCount == 0) <-- yours may be  if (newValue == nil)
            {
                print("Charts: data argument is nil on setData()", terminator: "\n")
                return
            }

            _dataNotSet = false
            _offsetsCalculated = false
            _data = newValue

            // calculate how many digits are needed
            calculateFormatter(min: _data.getYMin(), max: _data.getYMax())

            notifyDataSetChanged() <-- this will trigger a redraw
        }

I would say there might be a problem that, if we filter the data and it's then empty, it will not trigger a redraw so lines and bars are still there? @danielgindi

@danielgindi
Copy link
Collaborator

I actually think that it should always not draw only when data is nil.
This should be made less ambiguous.

@liuxuan30
Copy link
Member

@danielgindi there is one scenario: if we have a filter, when filting 'all', it show 10 bars, and if we filt and lead it to no data, currently, the bars are still there. Would it be better to do a redraw and show nothing? Like leave an empty axis, range from [0,1].

@danielgindi
Copy link
Collaborator

Well with the latest commits- it will be more controllable, to the developer's opinion.

As long as data is nil- the "no data" will show. If you have data with zero points, then it will draw the background and axis etc.

So if you've filtered your data and got zero results- you could pass in a nil data to show the "no data", or you can pass an empty data to keep the chart consistent with the other by drawing the grid.

With previous versions this was not possible due to the yValCount == 0 condition

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

3 participants