score:1
Accepted answer
You can sort the departments in ascending order and later create new data by the result.
departments.sort((a, b) => {
return ((data[a]["104"][0] + data[a]["104"][1]) - (data[b]["104"][0] + data[b]["104"][1]))
})
score:0
for sort any array you can use this function sort
function sort(arr, dir) {
for (var i = 0; i < arr.length-1; i++) {
for (var j = 0; j < arr.length-i-1; j++) {
if ((arr[j+1] > arr[j] && dir == "desc") || (arr[j+1] < arr[j] && dir == "asc")) {
var tmp = arr[j+1];
arr[j+1] = arr[j];
arr[j] = tmp;
}
}
}
}
var testArr = [6, 34, 22, 12, 3, 3, 4];
sort(testArr, "asc");
console.log(testArr);
sort(testArr, "desc");
console.log(testArr);
Source: stackoverflow.com
Related Query
- How can I sort the stacked bar charts in Highcharts by the sum of positive response?
- In highcharts's stacked bar chart, how can I remove the white space between different
- Highcharts - How do I keep both line points in from splitting between the two bar charts
- How can i load external json data in highcharts to show the bar chart
- How can I prepare a Group Stacked Bar Chart in Highcharts using multiple and different types of data?
- Stacked Bar Highcharts how to show the values
- Highcharts Chart Bar - How can I display in the chart, only one column from my HTML table?
- How can I draw Highcharts horizontal stacked bar with date-time duration
- How do I have text display within the inside of a stacked bar graph in highcharts
- How can you align the left and right Y-axes of vertically stacked HighCharts charts?
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- How can I create a horizontal stacked bar chart with labels on the bars themselves as well as labels above the bars?
- Align second scatter series to the side similar to how column and bar charts do using HighCharts
- how can I use rangeselector and navigation in highcharts in the given code
- How to specify a start point on highcharts stacked bar charts
- Highcharts stacked bar chart - how to get the stacks values
- HighCharts - How can I turn off the points?
- How can I change the colors of my highcharts piechart?
- How can i hide all the Series in highcharts at a time
- How can I remove the white border from HighCharts pie chart?
- Highcharts Bar Chart - How to set the minimum bar width/length
- How can I delete all of the points from a highcharts series
- How can I show the label next to the bar in r highcharter?
- Highcharts tootip for stacked bar charts
- How can i keep the color the same in highcharts
- How to set the x value for High Charts error bar
- Highcharts stacked bar negative / positive total
- Highcharts: How to provide a custom stack label in highcharts bar graph from within the stackLabel formatter?
- How do you set the stack order of the series in a stacked bar chart?
- How to get the Div id of charts in highcharts on click of it in angular 6
More Query from same tag
- NodeJS highchart save png
- Getting all colors from a div with jQuery/JS
- How to access y - data in stack column after one of the legend is pressed/removed?
- Center text inside rect using Highcharts Drawing API
- Highcharts: Rendering Incorrectly Prices between Percent/Value
- PLotLines In HighCharts Overlapping || React highCharts || YAxis Interval
- Point marker disabled on normal state and enabled on select and hover states - it is not working for select state
- How to display Highcharts x-axis time stamp labels inside tooltip?
- Highcharts: Custom area outline for line joining each marker
- Highcharts strange lines
- Width for labels on x Axis with grouped Categories in Highcharts
- How to properly update the nodes on a Highcharts Sankey?
- Access and chart through perl arrays
- Highcharts - master-detail - master with multiple color
- How do I customize xAxis labels at start and at end?
- How to bring up tooltips in a line chart when the points are on the same point x
- Highcharts loading image
- Highcharts combination of line chart and treemap
- min and max axis value not respected in HighCharts chart with a logarithmic axis
- Uncaught TypeError: $(...).highcharts is not a function in aspx web page with master page but it is working with basic html page
- HighCharts: Is it possible to remove every other value on the x-axis?
- Invalid dates in Highcharts with data loaded by JSON
- Highstock Navigator plugin doesn't render in firefox
- Highcharts: Fade plotLines based on hover on marker
- How to create highcharts maps using Angularjs?
- Irregular Display of Chart In Highstocks
- What would be an alternative to running Twig for loop inside javascript?
- Improve highcharts performance for large amounts of data
- Want to make the Highcharts Bar Chart data labels appear on the far right in the chart
- highchart/highstock tooltip does not adjust after zoom