How do I set the colorAxis of a googleVis bubble chart?
up vote
0
down vote
favorite
I try to adapt the GoogleVis bubble chart example with a continuous color scale for the bubbles based on the profit column:
library(googleVis)
Bubble <- gvisBubbleChart(Fruits, idvar="Fruit",
xvar="Sales", yvar="Expenses",
colorvar="Profit",
options=list(
## custom color
## colors = "['red', 'green', 'blue']",
## custom color scale does not work
colorAxis="{colors: ['yellow', 'red']}",
hAxis='{minValue:75, maxValue:125}'))
plot(Bubble)
However, whatevery I try with the 'colorAxis' option it does not work, while I do follow the official documentation. It seems weird, because when I look at the source code of the plot I can see that the option is set:
// jsDrawChart
function drawChartBubbleChartID2b6add84971() {
var data = gvisDataBubbleChartID2b6add84971();
var options = {};
options["colorAxis"] = {colors: ['yellow', 'red']};
options["hAxis"] = {minValue:75, maxValue:125};
var chart = new google.visualization.BubbleChart(
document.getElementById('BubbleChartID2b6add84971')
);
chart.draw(data,options);
}
What am I doing wrong? Thanks for any help.
r googlevis
add a comment |
up vote
0
down vote
favorite
I try to adapt the GoogleVis bubble chart example with a continuous color scale for the bubbles based on the profit column:
library(googleVis)
Bubble <- gvisBubbleChart(Fruits, idvar="Fruit",
xvar="Sales", yvar="Expenses",
colorvar="Profit",
options=list(
## custom color
## colors = "['red', 'green', 'blue']",
## custom color scale does not work
colorAxis="{colors: ['yellow', 'red']}",
hAxis='{minValue:75, maxValue:125}'))
plot(Bubble)
However, whatevery I try with the 'colorAxis' option it does not work, while I do follow the official documentation. It seems weird, because when I look at the source code of the plot I can see that the option is set:
// jsDrawChart
function drawChartBubbleChartID2b6add84971() {
var data = gvisDataBubbleChartID2b6add84971();
var options = {};
options["colorAxis"] = {colors: ['yellow', 'red']};
options["hAxis"] = {minValue:75, maxValue:125};
var chart = new google.visualization.BubbleChart(
document.getElementById('BubbleChartID2b6add84971')
);
chart.draw(data,options);
}
What am I doing wrong? Thanks for any help.
r googlevis
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I try to adapt the GoogleVis bubble chart example with a continuous color scale for the bubbles based on the profit column:
library(googleVis)
Bubble <- gvisBubbleChart(Fruits, idvar="Fruit",
xvar="Sales", yvar="Expenses",
colorvar="Profit",
options=list(
## custom color
## colors = "['red', 'green', 'blue']",
## custom color scale does not work
colorAxis="{colors: ['yellow', 'red']}",
hAxis='{minValue:75, maxValue:125}'))
plot(Bubble)
However, whatevery I try with the 'colorAxis' option it does not work, while I do follow the official documentation. It seems weird, because when I look at the source code of the plot I can see that the option is set:
// jsDrawChart
function drawChartBubbleChartID2b6add84971() {
var data = gvisDataBubbleChartID2b6add84971();
var options = {};
options["colorAxis"] = {colors: ['yellow', 'red']};
options["hAxis"] = {minValue:75, maxValue:125};
var chart = new google.visualization.BubbleChart(
document.getElementById('BubbleChartID2b6add84971')
);
chart.draw(data,options);
}
What am I doing wrong? Thanks for any help.
r googlevis
I try to adapt the GoogleVis bubble chart example with a continuous color scale for the bubbles based on the profit column:
library(googleVis)
Bubble <- gvisBubbleChart(Fruits, idvar="Fruit",
xvar="Sales", yvar="Expenses",
colorvar="Profit",
options=list(
## custom color
## colors = "['red', 'green', 'blue']",
## custom color scale does not work
colorAxis="{colors: ['yellow', 'red']}",
hAxis='{minValue:75, maxValue:125}'))
plot(Bubble)
However, whatevery I try with the 'colorAxis' option it does not work, while I do follow the official documentation. It seems weird, because when I look at the source code of the plot I can see that the option is set:
// jsDrawChart
function drawChartBubbleChartID2b6add84971() {
var data = gvisDataBubbleChartID2b6add84971();
var options = {};
options["colorAxis"] = {colors: ['yellow', 'red']};
options["hAxis"] = {minValue:75, maxValue:125};
var chart = new google.visualization.BubbleChart(
document.getElementById('BubbleChartID2b6add84971')
);
chart.draw(data,options);
}
What am I doing wrong? Thanks for any help.
r googlevis
r googlevis
edited Nov 9 at 13:09
Martin Schmelzer
11.8k23461
11.8k23461
asked Nov 9 at 12:06
Martin
802612
802612
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
UPDATE:
After I added an issue on GitHub, the problem should be resolved for the current developer version on GitHub (devtools::install_github("mages/googleVis")
). And indeed, it works:
The problem seems to be the data column "Profit":
var datajson = [
["Apples", 98, 78, "20"],
["Oranges", 96, 81, "15"],
["Bananas", 85, 76, "9"]
];
data.addColumn('string','Fruit');
data.addColumn('number','Sales');
data.addColumn('number','Expenses');
data.addColumn('string','Profit');
For reasons I do not see this column is defined as a string
type column. When you change the relevant lines to
var datajson = [
["Apples", 98, 78, 20],
["Oranges", 96, 81, 15],
["Bananas", 85, 76, 9]
];
data.addColumn('number','Profit');
a gradient color scale is applied to the bubbles.
This might be a bug in the googleVis
implementation since the Fruits
data defines the Profit column to be numeric.
Hi Martin, Thank you very much. Not only for reporting the issue, but I now also learned how I could have diagnosed the problem myself (look at the datajson). I will install the dev version!
– Martin
Nov 9 at 17:11
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
UPDATE:
After I added an issue on GitHub, the problem should be resolved for the current developer version on GitHub (devtools::install_github("mages/googleVis")
). And indeed, it works:
The problem seems to be the data column "Profit":
var datajson = [
["Apples", 98, 78, "20"],
["Oranges", 96, 81, "15"],
["Bananas", 85, 76, "9"]
];
data.addColumn('string','Fruit');
data.addColumn('number','Sales');
data.addColumn('number','Expenses');
data.addColumn('string','Profit');
For reasons I do not see this column is defined as a string
type column. When you change the relevant lines to
var datajson = [
["Apples", 98, 78, 20],
["Oranges", 96, 81, 15],
["Bananas", 85, 76, 9]
];
data.addColumn('number','Profit');
a gradient color scale is applied to the bubbles.
This might be a bug in the googleVis
implementation since the Fruits
data defines the Profit column to be numeric.
Hi Martin, Thank you very much. Not only for reporting the issue, but I now also learned how I could have diagnosed the problem myself (look at the datajson). I will install the dev version!
– Martin
Nov 9 at 17:11
add a comment |
up vote
0
down vote
accepted
UPDATE:
After I added an issue on GitHub, the problem should be resolved for the current developer version on GitHub (devtools::install_github("mages/googleVis")
). And indeed, it works:
The problem seems to be the data column "Profit":
var datajson = [
["Apples", 98, 78, "20"],
["Oranges", 96, 81, "15"],
["Bananas", 85, 76, "9"]
];
data.addColumn('string','Fruit');
data.addColumn('number','Sales');
data.addColumn('number','Expenses');
data.addColumn('string','Profit');
For reasons I do not see this column is defined as a string
type column. When you change the relevant lines to
var datajson = [
["Apples", 98, 78, 20],
["Oranges", 96, 81, 15],
["Bananas", 85, 76, 9]
];
data.addColumn('number','Profit');
a gradient color scale is applied to the bubbles.
This might be a bug in the googleVis
implementation since the Fruits
data defines the Profit column to be numeric.
Hi Martin, Thank you very much. Not only for reporting the issue, but I now also learned how I could have diagnosed the problem myself (look at the datajson). I will install the dev version!
– Martin
Nov 9 at 17:11
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
UPDATE:
After I added an issue on GitHub, the problem should be resolved for the current developer version on GitHub (devtools::install_github("mages/googleVis")
). And indeed, it works:
The problem seems to be the data column "Profit":
var datajson = [
["Apples", 98, 78, "20"],
["Oranges", 96, 81, "15"],
["Bananas", 85, 76, "9"]
];
data.addColumn('string','Fruit');
data.addColumn('number','Sales');
data.addColumn('number','Expenses');
data.addColumn('string','Profit');
For reasons I do not see this column is defined as a string
type column. When you change the relevant lines to
var datajson = [
["Apples", 98, 78, 20],
["Oranges", 96, 81, 15],
["Bananas", 85, 76, 9]
];
data.addColumn('number','Profit');
a gradient color scale is applied to the bubbles.
This might be a bug in the googleVis
implementation since the Fruits
data defines the Profit column to be numeric.
UPDATE:
After I added an issue on GitHub, the problem should be resolved for the current developer version on GitHub (devtools::install_github("mages/googleVis")
). And indeed, it works:
The problem seems to be the data column "Profit":
var datajson = [
["Apples", 98, 78, "20"],
["Oranges", 96, 81, "15"],
["Bananas", 85, 76, "9"]
];
data.addColumn('string','Fruit');
data.addColumn('number','Sales');
data.addColumn('number','Expenses');
data.addColumn('string','Profit');
For reasons I do not see this column is defined as a string
type column. When you change the relevant lines to
var datajson = [
["Apples", 98, 78, 20],
["Oranges", 96, 81, 15],
["Bananas", 85, 76, 9]
];
data.addColumn('number','Profit');
a gradient color scale is applied to the bubbles.
This might be a bug in the googleVis
implementation since the Fruits
data defines the Profit column to be numeric.
edited Nov 9 at 15:23
answered Nov 9 at 13:20
Martin Schmelzer
11.8k23461
11.8k23461
Hi Martin, Thank you very much. Not only for reporting the issue, but I now also learned how I could have diagnosed the problem myself (look at the datajson). I will install the dev version!
– Martin
Nov 9 at 17:11
add a comment |
Hi Martin, Thank you very much. Not only for reporting the issue, but I now also learned how I could have diagnosed the problem myself (look at the datajson). I will install the dev version!
– Martin
Nov 9 at 17:11
Hi Martin, Thank you very much. Not only for reporting the issue, but I now also learned how I could have diagnosed the problem myself (look at the datajson). I will install the dev version!
– Martin
Nov 9 at 17:11
Hi Martin, Thank you very much. Not only for reporting the issue, but I now also learned how I could have diagnosed the problem myself (look at the datajson). I will install the dev version!
– Martin
Nov 9 at 17:11
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53225425%2fhow-do-i-set-the-coloraxis-of-a-googlevis-bubble-chart%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown