PageSourceSearch

https://observatoriosaudepublica.com.br/static/frontend/js/plots/graph-output/plotFaixaEtariaDadosAtuais.js

js observatoriosaudepublica.com.br collected 2026-10-03 22:15:29 UTC 3,157 bytes, 130 lines download raw bytes

1function plotFaixaEtariaDadosAtuais(label, total, total_h, total_nh, percentual_h, percentual_nh, titulo, fonte, label1, label2) {
2
3  var fonte1 = 'Fonte: '
4  var total_h_neg = total_h.map(function (x) { return x * -1; });
5  var maximo = Math.max.apply(Math, (total_h.concat(total_nh)));
6  var maximo_text = Intl.NumberFormat().format(maximo).replace(/,/g, '.')
7
8  var tick_format = "";
9    
10  if (maximo < 1000) {
11      tick_format = "d";
12  } else {
13      tick_format = "s";
14  }
15
16  var trace1 = {
17    type: 'bar',
18    x: total_h_neg,
19    y: label,
20    orientation: 'h',
21    name: "",
22    marker: { color: "rgba(167,144,196,1)" },
23    text: total_h,
24    texttemplate: "<b>%{text:,.}</b>",
25    textposition: 'outside',
26    textfont: { size: 10, color: "rgba(167,144,196,1)" },
27    customdata: percentual_h,
28    hovertemplate: "<b>" + label1 + "</b><br>%{y} <br>%{text:,.} pessoas<br>%{customdata:.1f}% na faixa",
29    hoverlabel: { font: { family: 'ZonaPro', size: 12 } }
30  }
31
32  var trace2 = {
33    type: 'bar',
34    x: total_nh,
35    y: label,
36    orientation: 'h',
37    name: "",
38    marker: { color: "rgba(67,154,151,1)" },
39    text: total_nh,
40    texttemplate: "<b>%{text:,.}</b>",
41    textposition: 'outside',
42    textfont: { size: 10, color: "rgba(67,154,151,1)" },
43    customdata: percentual_nh,
44    hovertemplate: "<b>" + label2 + "</b><br>%{y} <br>%{text:,.} pessoas<br>%{customdata:.1f}% na faixa",
45    hoverlabel: { font: { family: 'ZonaPro', size: 12 } }
46  }
47
48  var data = [trace1, trace2]
49
50  var layout = {
51    barmode: "overlay",
52    title: {
53      text: titulo,
54      font: { size: 11 },
55      xanchor: "center",
56      x: 0.5
57    },
58    showlegend: false,
59    hovermode: 'closest',
60    yaxis: {
61      tickfont: { size: 11 },
62      fixedrange: true,
63      tickformat: tick_format
64    },
65    xaxis: {
66      showticklabels: true,
67      fixedrange: true,
68      tickfont: { size: 11 },
69      ticklen: 10, tickcolor: '#fff',
70      range: [maximo * -1.75, maximo * 1.75],
71      tickvals: [maximo * -1, 0, maximo],
72      ticktext: [maximo_text, 0, maximo_text]
73    },
74    margin: { l: 100, t: 175, r: 10, b: 70 },
75    paper_bgcolor: 'rgba(255,255,255,0)',
76    plot_bgcolor: 'rgba(255,255,255,0)',
77    separators: ",.",
78    autosize: true, height: 450,
79    annotations: [
80      {
81        x: 1,
82        y: -0.3,
83        xref: 'paper',
84        yref: 'paper',
85        xanchor: 'right',
86        text: fonte1.concat(fonte),
87        showarrow: false,
88        font: {
89          size: 10,
90          color: '#666666'
91        }
92
93      },
94      {
95        x: 0,
96        y: 1.1,
97        xref: 'x',
98        yref: 'paper',
99        xanchor: 'right',
100        text: "<b>" + label1 + "</b>",
101        showarrow: false,
102        font: {
103          size: 10,
104          color: 'rgba(167,144,196,1)'
105        }
106      },
107      {
108        x: 0,
109        y: 1.1,
110        xref: 'x',
111        yref: 'paper',
112        xanchor: 'left',
113        text: "<b>" + label2 + "</b>",
114        showarrow: false,
115        font: {
116          size: 10,
117          color: 'rgba(67,154,151,1)'
118        }
119
120      }
121    ],
122    font: { family: 'ZonaPro' }
123
124  }
125
126  return {
127    'data': data,
128    'layout': layout
129  }
130}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.