How to use the highcharts/highstock.numberFormat function in highcharts

To help you get started, we’ve selected a few highcharts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitshares / bitshares-ui / web / app / components / Exchange / PriceChart.jsx View on Github external
let price_dec = base.get("precision");
                    let vol_dec = quote.get("precision");
                    let time =  Highcharts.dateFormat("%Y-%m-%d %H:%M", this.x);


                    if (!this.points || this.points.length === 0) {
                        return "";
                    }

                    let TA = (this.points[1] && "indicators" in this.points[1]) ? reduce(this.points[1].indicators, (finalString, indicator, key) => {
                        return finalString + "<b>" + key.toUpperCase() + "</b>" + ": " + Highcharts.numberFormat(indicator[1], price_dec, ".", ",") + "  ";
                    }, "") : "";

                    return ("<span style="color: &quot; + colors[theme].tooltipColor +&quot;;fill: &quot;+ colors[theme].tooltipFillColor + &quot;">" +
                             "<b>Open:&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.open, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;High:&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.high, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;Time:&nbsp;&nbsp;&nbsp;</b>" + time +
                             "<br><b>Close:&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.close, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;Low:&nbsp;&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.low, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;&nbsp;Vol:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1] ? this.points[0].point.y : 0, vol_dec, ".", ",") + "&nbsp;&nbsp;" + quoteSymbol + "<br>"
                             + TA + "</span>");

                },
                positioner: function () {
github bitshares / bitshares-ui / web / app / components / Exchange / PriceChart.jsx View on Github external
let TA = (this.points[1] &amp;&amp; "indicators" in this.points[1]) ? reduce(this.points[1].indicators, (finalString, indicator, key) =&gt; {
                        return finalString + "<b>" + key.toUpperCase() + "</b>" + ": " + Highcharts.numberFormat(indicator[1], price_dec, ".", ",") + "  ";
                    }, "") : "";
github bitshares / bitshares-ui / web / app / components / Exchange / PriceChart.jsx View on Github external
if (!this.points || this.points.length === 0) {
                        return "";
                    }

                    let TA = (this.points[1] &amp;&amp; "indicators" in this.points[1]) ? reduce(this.points[1].indicators, (finalString, indicator, key) =&gt; {
                        return finalString + "<b>" + key.toUpperCase() + "</b>" + ": " + Highcharts.numberFormat(indicator[1], price_dec, ".", ",") + "  ";
                    }, "") : "";

                    return ("<span style="color: &quot; + colors[theme].tooltipColor +&quot;;fill: &quot;+ colors[theme].tooltipFillColor + &quot;">" +
                             "<b>Open:&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.open, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;High:&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.high, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;Time:&nbsp;&nbsp;&nbsp;</b>" + time +
                             "<br><b>Close:&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.close, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;Low:&nbsp;&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.low, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;&nbsp;Vol:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1] ? this.points[0].point.y : 0, vol_dec, ".", ",") + "&nbsp;&nbsp;" + quoteSymbol + "<br>"
                             + TA + "</span>");

                },
                positioner: function () {
github bitshares / bitshares-ui / web / app / components / Exchange / PriceChart.jsx View on Github external
if (!this.points || this.points.length === 0) {
                        return "";
                    }

                    let TA = (this.points[1] &amp;&amp; "indicators" in this.points[1]) ? reduce(this.points[1].indicators, (finalString, indicator, key) =&gt; {
                        return finalString + "<b>" + key.toUpperCase() + "</b>" + ": " + Highcharts.numberFormat(indicator[1], price_dec, ".", ",") + "  ";
                    }, "") : "";

                    return ("<span style="color: &quot; + colors[theme].tooltipColor +&quot;;fill: &quot;+ colors[theme].tooltipFillColor + &quot;">" +
                             "<b>Open:&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.open, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;High:&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.high, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;Time:&nbsp;&nbsp;&nbsp;</b>" + time +
                             "<br><b>Close:&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.close, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;Low:&nbsp;&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1].point.low, price_dec, ".", ",") +
                             "<b>&nbsp;&nbsp;&nbsp;Vol:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>" + Highcharts.numberFormat(this.points[1] ? this.points[0].point.y : 0, vol_dec, ".", ",") + "&nbsp;&nbsp;" + quoteSymbol + "<br>"
                             + TA + "</span>");

                },
                positioner: function () {
github bitshares / bitshares-ui / app / components / Exchange / PriceChart.jsx View on Github external
"<br><b>Close:&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(
                            this.points[1].point.close,
                            price_dec,
                            ".",
                            ","
                        ) +
                        "<b>&nbsp;&nbsp;Low:&nbsp;&nbsp;&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(
                            this.points[1].point.low,
                            price_dec,
                            ".",
                            ","
                        ) +
                        "<b>&nbsp;&nbsp;&nbsp;Vol:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(
                            this.points[1] ? this.points[0].point.y : 0,
                            vol_dec,
                            ".",
                            ","
                        ) +
                        "&nbsp;&nbsp;" +
                        quoteSymbol +
                        "<br>" +
                        TA +
                        ""
                    );
                },
                positioner: function() {
github bitshares / bitshares-ui / app / components / Exchange / PriceChart.jsx View on Github external
(finalString, indicator, key) =&gt; {
                                      return (
                                          finalString +
                                          "<b>" +
                                          key.toUpperCase() +
                                          "</b>" +
                                          ": " +
                                          Highcharts.numberFormat(
                                              indicator[1],
                                              price_dec,
                                              ".",
                                              ","
                                          ) +
                                          "  "
                                      );
                                  },
                                  ""
github bitshares / bitshares-ui / app / components / Exchange / PriceChart.jsx View on Github external
) +
                                          "  "
                                      );
                                  },
                                  ""
                              )
                            : "";

                    return (
                        "<span style="color: &quot; +
                        colors[theme].tooltipColor +
                        &quot;;fill: &quot; +
                        colors[theme].tooltipFillColor +
                        &quot;">" +
                        "<b>Open:&nbsp;&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(
                            this.points[1].point.open,
                            price_dec,
                            ".",
                            ","
                        ) +
                        "<b>&nbsp;&nbsp;High:&nbsp;&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(
                            this.points[1].point.high,
                            price_dec,
                            ".",
                            ","
                        ) +
                        "<b>&nbsp;&nbsp;Time:&nbsp;&nbsp;&nbsp;</b>" +
                        time +
                        "<br><b>Close:&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(</span>
github bitshares / bitshares-ui / app / components / Exchange / PriceChart.jsx View on Github external
return (
                        "<span style="color: &quot; +
                        colors[theme].tooltipColor +
                        &quot;;fill: &quot; +
                        colors[theme].tooltipFillColor +
                        &quot;">" +
                        "<b>Open:&nbsp;&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(
                            this.points[1].point.open,
                            price_dec,
                            ".",
                            ","
                        ) +
                        "<b>&nbsp;&nbsp;High:&nbsp;&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(
                            this.points[1].point.high,
                            price_dec,
                            ".",
                            ","
                        ) +
                        "<b>&nbsp;&nbsp;Time:&nbsp;&nbsp;&nbsp;</b>" +
                        time +
                        "<br><b>Close:&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(
                            this.points[1].point.close,
                            price_dec,
                            ".",
                            ","
                        ) +
                        "<b>&nbsp;&nbsp;Low:&nbsp;&nbsp;&nbsp;&nbsp;</b>" +
                        Highcharts.numberFormat(</span>
github tronscan / tronscan-frontend / src / components / common / LineCharts.js View on Github external
formatter: function () {
                        var s;
                        var points = this.points;
                        var pointsLength = points.length;
                      
                        s = ''
                        for (let index = 0; index &lt; pointsLength; index += 1) {
                            s += '' +
                                ''
                        }
                        s += '<table style="border: 0px;padding-left:10px;padding-right:10px" class="tableformat"><tbody><tr><td style="padding-bottom:5px;" colspan="2"><span style="font-size: 10px;"> ' + moment(points[0].x).format("YYYY-MM-DD") + '</span><br></td></tr><tr><td valign="top" style="padding-top:4px;padding-bottom:4px;border-top:1px solid #D5D8DC;">' + '<span style="color:' + points[index].series.color + ';font-size: 15px !important;">\u25A0</span> ' + intl.formatMessage({id: points[index].series.name })+ '</td><td style="padding-top:5px;padding-left:10px;padding-bottom:4px;border-top:1px solid #D5D8DC;" align="right"><span><b style="color:#C23631">' +
                                (points[index].series.name == intl.formatMessage({id: 'freezing_column_freezing_rate'}) ? Highcharts.numberFormat(points[index].y, 2, '.', ',') + ' %</b>' : points[index].series.name ==  intl.formatMessage({id: 'freezing_column_total_circulation'}) ?  toThousands((new BigNumber(points[index].y)).decimalPlaces(6)) + '':Highcharts.numberFormat(points[index].y, 0, '.', ',') + '')
                                + '</span>' +
                                '</td></tr></tbody></table>';
                        return s;
                    },
github bitshares / bitshares-ui / web / app / components / Exchange / PriceChart.jsx View on Github external
formatter: function() {
                            if (this.value !== 0) {
                                if ( this.value > 1000000 ) {
                                    return Highcharts.numberFormat( this.value / 1000, 2) + "M";
                                } else if ( this.value > 1000 ) {
                                    return Highcharts.numberFormat( this.value / 1000, 1) + "k";
                                } else {
                                    return this.value;
                                }
                            } else {
                                return null;
                            }
                        }
                    },