Skip to main content
improved formatting
Source Link
aronadaal
  • 9.2k
  • 1
  • 20
  • 36

Ok. After so many trial and errors, I managed to do this. Here is how iI did (providing here to help future readers).

I added a column called value in my dataset

data1 <- data1 %>% mutate(value = ifelse(Changelabel == ">20% Decrease",1,
                                                     ifelse(Changelabel == "<20% Decrease",2,
                                                            ifelse(Changelabel == "<20% Increase",3,
                                                                   ifelse(Changelabel == ">20% Increase",4, 5)))))

And then I created a data class for color axis,:

dclass <- data_frame(from = seq(1, 4, by = 1),
                     name = c(">20% Decrease","<20% Decrease","<20% Increase",">20% Increase"),
                     color = c("#00B0F0","#B7DEE8","#92D050","#00B050"))
dclass <- list_parse(dclass)

Then in my chart making code, I added this line,:

hc_colorAxis(dataClasses = dclass)

Now it workedworks with proper legend as iI expected.

Ok. After so many trial and errors, I managed to do this. Here is how i did (providing here to help future readers).

I added a column called value in my dataset

data1 <- data1 %>% mutate(value = ifelse(Changelabel == ">20% Decrease",1,
                                                     ifelse(Changelabel == "<20% Decrease",2,
                                                            ifelse(Changelabel == "<20% Increase",3,
                                                                   ifelse(Changelabel == ">20% Increase",4, 5)))))

And then created a data class for color axis,

dclass <- data_frame(from = seq(1, 4, by = 1),
                     name = c(">20% Decrease","<20% Decrease","<20% Increase",">20% Increase"),
                     color = c("#00B0F0","#B7DEE8","#92D050","#00B050"))
dclass <- list_parse(dclass)

Then in my chart making code, added this line,

hc_colorAxis(dataClasses = dclass)

Now it worked with proper legend as i expected.

Ok. After so many trial and errors, I managed to do this. Here is how I did (providing here to help future readers).

I added a column called value in my dataset

data1 <- data1 %>% mutate(value = ifelse(Changelabel == ">20% Decrease",1,
                          ifelse(Changelabel == "<20% Decrease",2,
                          ifelse(Changelabel == "<20% Increase",3,
                          ifelse(Changelabel == ">20% Increase",4, 5)))))

And then I created a data class for color axis:

dclass <- data_frame(from = seq(1, 4, by = 1),
                     name = c(">20% Decrease","<20% Decrease","<20% Increase",">20% Increase"),
                     color = c("#00B0F0","#B7DEE8","#92D050","#00B050"))
dclass <- list_parse(dclass)

Then in my chart making code I added this line:

hc_colorAxis(dataClasses = dclass)

Now it works with proper legend as I expected.

Source Link
ds_user
  • 2.2k
  • 6
  • 42
  • 71

Ok. After so many trial and errors, I managed to do this. Here is how i did (providing here to help future readers).

I added a column called value in my dataset

data1 <- data1 %>% mutate(value = ifelse(Changelabel == ">20% Decrease",1,
                                                     ifelse(Changelabel == "<20% Decrease",2,
                                                            ifelse(Changelabel == "<20% Increase",3,
                                                                   ifelse(Changelabel == ">20% Increase",4, 5)))))

And then created a data class for color axis,

dclass <- data_frame(from = seq(1, 4, by = 1),
                     name = c(">20% Decrease","<20% Decrease","<20% Increase",">20% Increase"),
                     color = c("#00B0F0","#B7DEE8","#92D050","#00B050"))
dclass <- list_parse(dclass)

Then in my chart making code, added this line,

hc_colorAxis(dataClasses = dclass)

Now it worked with proper legend as i expected.