Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Set fixed yticks labels in plotly

Hi guys,
I want to now hoe to set fixed y ticks labels for bar plot in plotly javascript, I don’t want the labels changes even if the vlues changes this code

make_plot = function(x_data,y,title,id){
            
            var trace1 = {
                domain: { x: [0.25, 0.75], y: [0.5,0.9] },
                value: arrayAverage(y),
                title: { text: 'Average' },
                type: "indicator",
                mode: "gauge+number",
                gauge: {
                    axis: { range: [0, 100], tickwidth: 1, tickcolor: "darkblue" },
                    bar: { color: "darkblue" }}
            };
            var x = {
                domain: { x: [0.25,0.75], y: [0,0.4] },
                type: 'bar',
                x: x_data,
                y: y,
                hovertemplate:'<i>Percentage</i>: %{y} \%' + '<br><b>X</b>: %{x}<br>'
            };
            var data = [x, trace1];
            var layout = {
                grid: {
                    rows: 2,
                    columns: 1,
                    pattern: 'independent',
                    roworder: 'bottom to top'},
                    xaxis: {
                    domain: [0.25, 0.75],
                    
                    anchor: 'y1'
                },
                yaxis:{
                    tickmode: "array", 
                    tickvals: [0, 20, 40, 60, 80, 100]
                },
                title: {
                    text: title
                },
                
            };
            Plotly.newPlot(id, data, layout);

and here’s the result as follows

I want to make all this plots with y ticks from 0 to 100 whatever the values are so how can I do this?

I believe you can set the range in the layout variable:

yaxis: {fixedrange: true},
xaxis : {fixedrange: true, range:[0,100]},