Git Product home page Git Product logo

Comments (5)

cebor avatar cebor commented on May 16, 2024 1

The options object gets extracted from the Charts object, so it should work as you described.

new Chart({
...
tooltip: {
  formatter: function () {
     return new Date(this.x).toLocaleString() + '<br><b>内存:</b>' + byte_to_string(this.y)
  }
}
...
});

Docs: http://www.highcharts.com/docs/chart-concepts/tooltip

from angular-highcharts.

vapao avatar vapao commented on May 16, 2024

@cebor thanks
byte_to_string is a function convert Byte to KB MB or GB, like this:

private byteToString(data: any): string {
        let kb = data / 1024
        if (kb > 1024) {
            let mb = kb / 1024
            if (mb > 1024) {
                return (mb / 1024).toFixed(2) + ' GB'
            } else {
                return mb.toFixed(2) + ' MB'
            }
        }
        return kb.toFixed(2) + ' KB'
    }

now browser console print: Uncaught TypeError: this.byteToString is not a function

from angular-highcharts.

cebor avatar cebor commented on May 16, 2024

I think the Problem is that, the options object and the class where you creating the Chart have different contexts.

Maybe making byteToString to a static method will solve this. - Example

Or use something like: var _this = this.

For further help, please show me more code of the class you declaring your chart.

from angular-highcharts.

cebor avatar cebor commented on May 16, 2024

I think, the problem is solved, so i'm closing this. Feel free to reopen.

from angular-highcharts.

vapao avatar vapao commented on May 16, 2024

yes, is solved. thanks.

from angular-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.