Die Bin-Größe des Highcharts-Histogramms zeigt einen falschen Wert für die letzte Bin anJavaScript

Javascript-Forum
Guest
 Die Bin-Größe des Highcharts-Histogramms zeigt einen falschen Wert für die letzte Bin an

Post by Guest »

Ich versuche, ein Histogrammdiagramm mit Highcharts einzurichten. Ich habe die Standardkonfigurationsoption binsNumber verwendet, die Quadratwurzel ist. Für einen bestimmten Wertesatz ist die Bin-Größe der endgültigen Bin falsch. Obwohl die Bin die gleiche Breite zu haben scheint, zeigt der Tooltip beim Bewegen des Mauszeigers eine kleinere, falsche Bin-Größe an. Auch die letzte Beschriftung auf der X-Achse ist nicht sichtbar (80 sollte angezeigt werden)

Code: Select all

const data = [
-18, -6, 82, -18, -18
];

Highcharts.chart('container', {
title: {
text: 'Highcharts Histogram'
},

xAxis: [{
title: { text: 'Data' },
alignTicks: false,
visible:false,
}, {
title: { text: 'Histogram' },
alignTicks: false,
}],

yAxis: [{
title: { text: 'Data' }
}, {
title: { text: 'Histogram' },
opposite: true
}],

plotOptions: {
histogram: {
accessibility: {
point: {
valueDescriptionFormat: '{index}. {point.x:.3f} to ' +
'{point.x2:.3f}, {point.y}.'
}
}
}
},

series: [{
name: 'Histogram',
type: 'histogram',
xAxis: 1,
yAxis: 1,
baseSeries: 's1',
zIndex: -1
}, {
name: 'Data',
type: 'scatter',
data: data,
visible:false,
id: 's1',
marker: {
radius: 1.5
}
}]
});

Code: Select all

.highcharts-figure,
.highcharts-data-table table {
min-width: 310px;
max-width: 800px;
margin: 1em auto;
}

.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #ebebeb;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}

.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}

.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}

.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
padding: 0.5em;
}

.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}

.highcharts-data-table tr:hover {
background: #f1f7ff;
}

.highcharts-description {
margin: 0.3rem 10px;
}

Code: Select all








Chart showing how Highcharts can automatically compute a histogram from
source data. In this chart, the source data is also displayed as a
scatter plot.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post