I feel like ive tried everything but nothing seem to work:
var charData = [{
x: x1,
y: y,
type: 'bar',
color: 'rgb(31,119,180)',
orientation: 'h',
name: 'Nuværende',
bar: {
color: 'rgb(rgb(31, 114, 225)'
}
}, {
x: x2,
y: y,
type: 'bar',
orientation: 'h',
name: 'Forventet'
}],
layout = {
title: 'Brugere',
barmode: 'stack',
legend: {
orientation: 'h'
}
};
Plotly.newPlot(area,charData,layout);
Ive also tried:
var charData = [{
x: x1,
y: y,
type: 'bar',
color: 'rgb(31,119,180)',
orientation: 'h',
name: 'Nuværende',
color: '#23b7e5'
}, {
x: x2,
y: y,
type: 'bar',
orientation: 'h',
name: 'Forventet'
}],
layout = {
title: 'Brugere',
barmode: 'stack',
legend: {
orientation: 'h'
}
};
Plotly.newPlot(area,charData,layout);
However the chart stays with default colors.
So how can i change colors using Plotly?
I feel like ive tried everything but nothing seem to work:
var charData = [{
x: x1,
y: y,
type: 'bar',
color: 'rgb(31,119,180)',
orientation: 'h',
name: 'Nuværende',
bar: {
color: 'rgb(rgb(31, 114, 225)'
}
}, {
x: x2,
y: y,
type: 'bar',
orientation: 'h',
name: 'Forventet'
}],
layout = {
title: 'Brugere',
barmode: 'stack',
legend: {
orientation: 'h'
}
};
Plotly.newPlot(area,charData,layout);
Ive also tried:
var charData = [{
x: x1,
y: y,
type: 'bar',
color: 'rgb(31,119,180)',
orientation: 'h',
name: 'Nuværende',
color: '#23b7e5'
}, {
x: x2,
y: y,
type: 'bar',
orientation: 'h',
name: 'Forventet'
}],
layout = {
title: 'Brugere',
barmode: 'stack',
legend: {
orientation: 'h'
}
};
Plotly.newPlot(area,charData,layout);
However the chart stays with default colors.
So how can i change colors using Plotly?
1 Answer
Reset to default 5Try:
var charData = [{
x: x1,
y: y,
type: 'bar',
orientation: 'h',
name: 'Nuværende',
marker: {
color: '#23b7e5'
}
}],
layout = {
title: 'Brugere',
barmode: 'stack',
legend: {
orientation: 'h'
}
};
Plotly.newPlot(area,charData,layout);
Another example here.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744282241a4566626.html
评论列表(0条)