Coder Social home page Coder Social logo

Comments (4)

gregjopa avatar gregjopa commented on August 17, 2024

I think we should support the no-data-to-display module. It seems like the standardized way of handling the "no data" use case.

Including the no-data-to-display module should still be optional and we should fallback to something reasonable (perhaps the current solution).

Can you send a PR for this?

from ember-highcharts.

shijistar avatar shijistar commented on August 17, 2024

I had also tried to show a label of noData message as a second fallback when highcharts 'no-data-to-display' module was not imported, just similar as what the module did. But I failed to align the label at center of the chart both in horizontal and vertical. Here is the sample code, you can continue working on it if you have interests.

buildOptions: computed('chartOptions', 'content.[]', function() {
    let chartOptions = $.extend(true, {}, get(this, 'theme'), get(this, 'chartOptions'));
    let defaults = {};
    let chartContent = get(this, 'content');
    // if 'no-data-to-display' module has been imported, keep empty series and leave it to highcharts to show no data label.
    if (!get(this, 'content.length') && !Highcharts.Chart.prototype.showNoData) {
        let defaultOptions = Highcharts.getOptions();
        var hasLabels = (chartOptions.labels && chartOptions.labels.items && chartOptions.labels.items.length);
        // Preferred to show chart labels rather than an empty series. 
        if (defaultOptions.lang.noData && !hasLabels) {
            defaults = assign(defaults, {
                labels: {
                    items: [{
                        html: defaultOptions.lang.noData,
                        style: {
                            fontWeight: 'bold',
                            color: '#666',
                            // There's no way to place the label at the exactly center, so it's not good enough. I don't know if there is a way for that.
                            left: 400,
                            top: 200
                        }
                    }]
                }
            });
        } else {
            // This is the very original implementation, keep it as the last fallback. 
            // However don't know how it works for promoting no data message, at least the data should be an array?
            chartContent = [{
                id: 'noData',
                data: 0,
                color: '#aaaaaa'
            }];
            defaults = assign(defaults, { series: chartContent });
        }
    }

    return assign(defaults, chartOptions);
  }),

from ember-highcharts.

muhammad-05 avatar muhammad-05 commented on August 17, 2024

hi all. I am also new to this topic. did the installation as the instructions. but with parameters and output graphs does not work. if there is a specialist ready to pay for the work that would chart displayed on the website.

from ember-highcharts.

gregjopa avatar gregjopa commented on August 17, 2024

Fixed by #98

from ember-highcharts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.