首页 > 解决方案 > 在 Plotly Js 上将绝对值更改为相对值

问题描述

直方图图像

我在 JS Plotly 中有上面的直方图,我需要将最大绝对频率更改为相对值。我正在努力将最大绝对频率更改为 100%。

我看到一些直方图功能使值的总和等于 100%,但在我的例子中,只有最高值是 100%,其余的是基于这个值的结果。

这是我正在处理的一些代码...

let air_temp_data = [1,2,n,+1000]
let graphicData = [
                {
                    x: air_temp_data,

                    marker: { color: '#2222AA' },
                    type: 'histogram',
                    xbins: {
                        end: 50,
                        size: graph_intervals,
                        start: -50
                    }
                }
            ];

let graphicLayout = {
                width: 900,
                height: 500,
                title: 'Critical Lines Frequency',
                bargap: 2,
                yaxis: {
                    title: 'Frequency (%)',

                    titlefont: {
                        size: 16,
                        color: 'rgb(107, 107, 107)'
                    }
                },
                xaxis: {
                    title: 'Air Temperature',

                    titlefont: {
                        size: 16,
                        color: 'rgb(107, 107, 107)'
                    }
                }
Plot.newPlot('criticalAmpacity', graphicData, graphicLayout);

有任何想法吗?谢谢!

标签: javascriptplotly

解决方案


推荐阅读