Giter VIP home page Giter VIP logo

mschart's People

Contributors

danjoplin avatar davidcamposeco avatar davidgohel avatar janmarvin avatar ravichandrasekaran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mschart's Issues

More flexible data labels?

Thank you for such a wonderful package.

I have a suggestion for what I hope is a simple enhancement. Would it be possible to have a user supplied vector of strings to use as data labels? For example

my_chart <- ms_barchart(data=my_data, x="x", y="y", ulabels="mystrings")

and then something like:

chart_data_labels(my_chart, show_ulabels = TRUE)

I am thinking of a statistical application where I would like to print the results of a significance test associated with each bar. However I think a feature like this would have many other uses.

using other characters than Basic Latin, I still got an error. Thanks.

I tested the following code on my machine. I can't open the PPT file. It told me there is an error.

library(magrittr)
library(mschart)
library(officer)

dat <- browser_data
dat[dat$browser %in% "Chrome", "browser"] <- "äÄ åÅ öÖ"
barchart <- ms_barchart(data = dat,
x = "browser",
y = "value",
group = "serie")
barchart <- chart_labels(barchart, title = "©")
doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_chart(doc, chart = barchart)
print(doc, target = "Presentation.pptx")

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] mschart_0.2.4 magrittr_1.5 officer_0.3.5

Option to turn off line smoothing (feature request)

Hi,

I am trying to recreate a chart that was made natively in powerpoint. The mschart function automatically sets Smoothed line to true (under "Format Data Series -> Fill & Line -> Line -> Smoothed line" in powerpoint). I have tried to fiddle around with the "ms_linechart" object but have been unsuccessful in my attempt to change that option to false because I cannot figure out what the option should be called. I'd appreciate if the feature could be added.

Additionally, if you could point me towards what you are using to figure out exactly what each argument should be called when the charts are put in powerpoint I would really appreciate it. That way I can contribute next time instead of needing to make an issue.

Thank you,
Persephone

Cannot effectively order bars

This is an extension to #24. I am trying to order some bars alphabetically. By default ms_barchart does this, but in the reverse order to what I want. I have attempted to do this with with ordered factors, unordered factors and just with characters. However the data always appear in the same order. For example, let's say we have some data:

data.frame(
  cat = ordered(c("A", "B", "C")),
  val = c(1, 2, 3)
) %>% 
  ms_barchart(x = "cat", y = "val") %>% 
  chart_settings(dir = "horizontal") %>% 
  print(preview = TRUE)

The data will be ordered C, B, A from top to bottom. If I change the cat variable to ordered(c("C", "B", "A")), it has no effect on the order.

I can, however flip the axis using the following:

data.frame(
  cat = ordered(c("A", "B", "C")),
  val = c(1, 2, 3)
) %>% 
  ms_barchart(x = "cat", y = "val") %>% 
  chart_settings(dir = "horizontal") %>% 
  chart_ax_x(tick_label_pos = "low", orientation = "maxMin") %>% 
  chart_ax_y(tick_label_pos = "high") %>% 
  print(preview = TRUE)

This almost gives me what I want, however I now have a solid line running across the top of the plot and I cannot for the life of me find how to remove this line.

Create more complex charts with subtitles and footers

Hi, we are working on an automated reporting tool to generate hundreds of MS Word documents. The documents contain a bunch of graphics like the following one:

customized_chart_engawa

Do you see any chance to achieve this with mschart? Especially:

  • subtitle(s)
  • footer

Missing officer system file

Hi,

When I install officer and mschart and attempt to create a test chart using iris data, I receive the following error message:

> testdoc <- ph_with_chart(testdoc, value = bar_test)
Error: '' does not exist in current working directory

traceback() on this error suggests a missing system file from the officer package:

> traceback()
9: stop("'", path, "' does not exist", if (!is_absolute_path(path)) paste0(" in current working directory ('", 
       getwd(), "')"), ".", call. = FALSE)
8: check_path(path)
7: path_to_connection(x)
6: read_xml.character(system.file(package = "officer", "template", 
       "chart.xml"))
5: read_xml(system.file(package = "officer", "template", "chart.xml"))
4: format.ms_chart(value, id_x = id_x, id_y = id_y)
3: format(value, id_x = id_x, id_y = id_y)
2: pml_chart(x, value, id_x = "64451712", id_y = "64453248")
1: ph_with_chart(testdoc, value = bar_test)

using other characters than Basic Latin

Hello,

I got problems using other characters than Basic Latin ones in PowerPoint charts.
When I add any of them anywhere into fresh PowerPoint into chart and then export it with print() I got error when opening presentation in PowerPoint. It just say's it's broken.
This could be fixed by unpacking file and changing "�" character.

I figured out, that problem is caused by mschart not officer, because you can add any characters in text fields with standard officer commands (like ph_with_text).

You could easily reproduce it with the code below.

library(officer)
library(mschart)
barchart <- ms_barchart(data = browser_data, 
                        x = "browser", 
                        y = "value", 
                        group = "serie")
barchart <- chart_labels(barchart,
                         title = "©")
doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_chart(doc, chart = barchart)
print(doc, target = "Presentation.pptx")

Best regards,
Peter

Adding images as axis labels?

Hi David,

Is it possible to add the ability to use images as axis labels? That would be a huge boon to usability for some of our client teams.

Thanks!

specials in num_fmt = cause errors

In attempting to format chart axes and labels as percentages, I passed the excel syntax for 2-decimal place percentages (0.00%) to num_fmt. However this causes the error

Error in sprintf(str_, dir_, x$options$grouping, x$options$vary_colors,  : 
  invalid format '%" s'; use format %f, %e, %g or %a for numeric objects

To appear. Escaping the special ("\\%") has no effect, and returns the same error.

Cannot colour bars based on conditional formatting

A feature enhancement that would be really useful is to colour bars based on conditional formatting. For example, let's say we have some data:

my_data <- data.frame(
  x = c("p_1", "p_2", "p_3"),
  score = c(1, 2, 3),
  training = c(FALSE, FALSE, TRUE)
)

I want to generate a bar chart of the scores, but I want to colour the bars for people with training in green and the bars for people without training in red. This isn't currently possible.

Target line in MS Bar chart

Hi All , (@davidgohel @DavidCamposeco @qfazille @clementinejager )

Hope you all doing good.

I needed your help in terms of achieving a requirement received by one of our clients.
We built a bar chart using MS Chart and exported it to a power point via Officers package but the client wants the bar chart to have a thin dotted/dashed target line.
Please find below the chart image for your reference.
image

Do you think it's possible to do it via MS Charts? We read the documentation provided by you and weren't able to find a feature that could help us get this line.
It would be great to have your assistance on it.

Thanks and Regards,
Ashish Nelson

Print no axis label

Is there a way to avoid printing an axis label on a chart? I've managed to get rid of the legend, but I have an x-axis label that I can't seem to get rid of. I still want to use the y-axis label, or I'd just set the font size of axis labels to 0. Any ideas?

chart_data_line_width works on scatter charts but not line charts

The following code is taken from the documentation and modified to use ms_linechart instead of ms_scatterchart.

my_scatter <- ms_linechart(data = iris, x = "Sepal.Length",
y = "Sepal.Width", group = "Species")
# my_scatter <- chart_settings(my_scatter, scatterstyle = "lineMarker")
my_scatter <- chart_data_fill(my_scatter,
values = c(virginica = "#6FA2FF", versicolor = "#FF6161", setosa = "#81FF5B") )
my_scatter <- chart_data_stroke(my_scatter,
values = c(virginica = "black", versicolor = "black", setosa = "black") )
my_scatter <- chart_data_symbol(my_scatter,
values = c(virginica = "circle", versicolor = "diamond", setosa = "circle") )
my_scatter <- chart_data_size(my_scatter,
values = c(virginica = 20, versicolor = 16, setosa = 20) )
my_scatter <- chart_data_line_width(my_scatter,
values = c(virginica = 2, versicolor = 3, setosa = 6) ) %>% print (preview = T)

The line width in the resulting graphic is defaulting to 3.75 on my machine (using the cran version of the repo) despite having been declared above. Note that when using a scatter plot instead of a line chart, chart_data_line_width works perfectly.

Series order reverts to alphabetical (even when series is a factor)

When creating a line chart with multiple data series, it appears that the order of the series order reverts to alphabetical even if the group variable is a factor.

This seems to be an issue with the latest github version. I had working code on an older version of mschart, and I believe this behaviour started when I updated to the latest version on github. I could not find any questions about this on github or on stackoverflow.

Thank you for looking into this!

Working example:

###Series in the line chart should be ordered C, A, B but they are ordered A, B, C instead
###Behaviour is the same whether or not you specify the factor is ordered
library(officer)
library(mschart)
library(magrittr)
data.frame(
  x=c(1,1,1,2,2,2,3,3,3),
  y=c(11:19),
  group=factor(rep(c("C","A","B"),3),levels=c("C","A","B"))
) %>%
  ms_linechart(x="x",y="y",group="group") %>%
  print(preview=T)

Session info:

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] magrittr_1.5      mschart_0.2.5     officer_0.3.9.008

loaded via a namespace (and not attached):
 [1] compiler_3.6.3    R6_2.4.1          htmltools_0.4.0   tools_3.6.3       Rcpp_1.0.3        cellranger_1.1.0 
 [7] uuid_0.1-4        xml2_1.3.2        writexl_1.2       data.table_1.12.8 digest_0.6.25     zip_2.0.4        
[13] rlang_0.4.5 

Highlighting the bar based on a condition

Hi Daniel ,

I am using this package called MS Charts in R where I want to build a horizontal bar chart but I need conditional formatting where the bar comprising of the least measurement should be surrounded with an orange border.

My Dataframe used for the chart looks like this

image

and the chart I require looks like the screenshot below :
image

I would be extremely grateful if you could assist me on how to proceed on it.

Thanks and Regards,
Ashish

change font size in legends

Hello, Great work. I was hoping there was a way to change the font size when a legend is added to a chart. Also, a way of changing the label font on the chart as well.

Thanks

How to give border for the mscharts & how to use chart_label_text function in ms_linecharts

Hi David,

I went through your MS_Chart documents, but could not find and option to add border to a chart.
Could you please tell me if there is any way to include a border to any mscharts.

Attached an image for you reference.

ms_line chart with border

Also, could you please tell us how to use chart_label_text for msline chart as the example mentioned in your documentation is of a msbar chart.
Please find below the screenshot of line chart I have created where I want to change data labels.
Y axis is clicks and X axis is date.

image

2 charts in one graph

Hi,

Is it possible to have 2 native charts in one plot with same x-axis and different y-axis? I'm trying to combine bar chart and line chart.

How to size plot area

Issues are a great way to keep track of tasks, enhancements, and bugs for your projects (https://guides.github.com/features/issues/). When submitting, you need to provide the following elements:

If you are reporting a bug:

  • The code that is producing the error, it has to be a minimal reproducible example.
    Stackoverflow is providing good explanations about it: https://stackoverflow.com/help/mcve. You can use package reprex to help you: http://reprex.tidyverse.org/. The most popular R stackoverflow question is about the subject: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example.

  • the results of R command sessionInfo(). It had to be executed after you loaded the packages used by your example. This will let me know what is your version of R and what are the versions of the packages you used in your example.

  • you did checked you had the latest version of the package on CRAN (and on github if issue exists with CRAN version).

  • you searched in the open and closed issues on the github repository.

If you are asking an enhancement or a new function

Explain the value, describe the situation.

Avoid beeing anonymous, it's not pleasant for me not knowing who talked to me.

Any suggestions to make the documentation better is really appreciated.

If you are asking a question

Don't, this is not the place where to put questions. If you are looking for help on how to use the package correctly, please visit Stackoverflow and tag your question with [r] and [package_name]. I usually read them and answer when possible.

chart_data_size not working

In the example bellow I'm creating a simple yes/no datable and then adding the "bar char" to a small area on e PowerPoint presentation ("Chart Placeholder 10")
Although I'm assigning the value 8 (as font size) to the char_data_size, when I open the powerpoint it's value is 18+

LO_achived <- data.frame(response=c("Yes","No"), value=c(95,5))
my_barchart <- ms_barchart(LO_achived,  x = "response", y = "value")
my_barchart <- chart_data_fill(my_barchart,  values = "#1F4A6A" )
my_barchart <- chart_settings( x = my_barchart, dir="vertical", grouping="clustered", gap_width = 2 )
my_barchart <- chart_labels(my_barchart, title = "Learning objectives were achieved")
text_size <- fp_text(color = "white", font.size = 8, font.family = "Century Gothic")
mytheme <- mschart_theme( main_title = fp_text(color = "white", font.size = 8, font.family = "Century Gothic"), legend_position = "n",axis_text_x = text_size, axis_text_y  = text_size)
my_barchart <- set_theme(my_barchart, mytheme)
my_barchart <- chart_data_size(my_barchart, value = 8 )
my_barchart <- chart_data_labels(my_barchart, show_val = T)
my_pres <- ph_with(my_pres, my_barchart , location = ph_location_label(ph_label = "Chart Placeholder 10") )

print(my_pres, target = "template1_test5.pptx")

image

chart_data_labels output font does not conform to chart_theme

It seems that, when reformatted using num_fmt = , data labels emplaced by chart_data_labels do not conform to the presentation theme, specifically regarding font. It seems that no matter the input from chart_theme(), the output font for data labels is always Calibri.

See #16 for an MWE that demonstrates the issue.

How can I ensure that data labels take the correct font?

Alignment Control for Chart Titles

Apologies if I am just being bad at reading the documentation! And thanks for making/maintaining this great package.

It doesn't seem like one can control the horizontal alignment of title text. In particular I would love to be able to left align the chart title.

outEnd data labels on a chart passed to as_bar_stack() do not populate in powerpoint

Hello,

This is a minor issue I noticed, just thought I would pass along.

If I send a bar chart with outEnd data labels to the as_bar_stack, the slide doesn't populate in the produced pptx. Changing to an internal data label works fine. Here is an example:

library(tidyverse)
library(mschart)
library(officer)


dat <- mtcars %>% 
  group_by(am, cyl) %>%
  summarise(disp = mean(disp))


bar_to_stack_outend <- ms_barchart(data = dat, x = "cyl", y = "disp", group = "am") %>% 
                chart_data_labels(show_val = TRUE, position = "outEnd") %>% 
                as_bar_stack()

bar_to_stack_ctr <- ms_barchart(data = dat, x = "cyl", y = "disp", group = "am") %>% 
  chart_data_labels(show_val = TRUE, position = "ctr") %>% 
  as_bar_stack()


doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme") %>% ph_with_chart(chart = bar_to_stack_outend)
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme") %>% ph_with_chart( chart = bar_to_stack_ctr)


print(doc, target = "example.pptx")

The first slide chart will fail inside PowerPoint (be blank), but the second will populate OK.

Thanks for such a fantastic tool as mschart, really appreciate it.

Cheers,
Ben

Change the size of data labels

Hi!
Thanks for the awesome package.
It would be useful to be able to change the size of data labels in a bar plot.
Labels that are set with:
chart_data_labels(my_barchart, position = 'outEnd', show_val = TRUE)

I can't find such function in set_theme. Yet, the labels are big and overlay with each other.

How to adjust size of the legend box and not the text in it

Hi,

I have a requirement that the legend box needs to be of one specific size. Is there any way I can do that?

And is there any provision by which we can choose the order of the legends?

Any help is highly appreciated on it :)

Thank you very much!

Barchart categories being reordered

I'm trying to make a barchart of average values in response to a question. I have three columns, question, mean and group. My data has my questions ordered correctly (though they are duplicated because of the group column. mschart sorts the questions in alphabetical order (and when I flip the barchart horizontal, in reverse alphabetical order). There doesn't seem to be a way to force the ordering of groups - is this intentional or is it an enhancement that could be made?

tmpdt = structure(list(question = c("I1_question", 
"A1_question", 
"M1_question", 
"I2_question", 
"O1_question", 
"O2_question", 
"M2_question", 
"W1_question", 
"I3_question", 
"A2_question", 
"M3_question", 
"I4_question", 
"O3_question", 
"O4_question", 
"M4_question", 
"W2_question"
), mean = c(4.17283950617284, 3.69230769230769, 4.01234567901235, 
3.83333333333333, 3.30434782608696, 3.33783783783784, 3.82716049382716, 
3.25161290322581, 4.12121212121212, 3.65625, 3.93939393939394, 
3.90909090909091, 3.16, 3.09677419354839, 3.87878787878788, 2.8125
), group = c("Total", "Total", "Total", "Total", "Total", "Total", 
"Total", "Total", "This Group", "This Group", 
"This Group", "This Group", "This Group", 
"This Group", "This Group", "This Group"
)), .Names = c("question", "mean", "group"), row.names = c(NA, 
-16L), class = "data.frame")

linec = ms_barchart(data = tmpdt,x="question",y="mean",group="group")

Documentation for percentage formats (%) has extraneous backslashes (\)

Documentation for the percentage num_fmt has extra backslashes included.

This StackOverflow question that I just answered references this specifically.
https://stackoverflow.com/questions/58998718/percentage-format-for-y-axis-in-mschart?noredirect=1#comment104251260_58998718

There are at least 2 related closed issues from late 2017, but it looks like that's when the double percentage sign requirement was clarified and introduced?

Checked CRAN, and issue exists there.

It's pretty easy to address, so I'll get a pull req ready, too.

Error in doc_parse_raw(x, encoding = encoding, base_url = base_url, as_html = as_html, : StartTag: invalid element name [68]

I am trying to make a bar-chart using the following code snippet but I am getting the following

error :-
Error in doc_parse_raw(x, encoding = encoding, base_url = base_url, as_html = as_html, : StartTag: invalid element name [68]

Please suggest a way to rectify this error.

code :-

summary <- data.frame(TotalAssets = rep(c("<$500k","$500k to $1M","$1M to $2M"
,"$2M to $5M","$5M to $10M","$10M to $50M","$50M to $100M",">$100M"),3)
,variable = c(rep("client",8),rep("EDF",8),rep("RC",8))
,value = c(rep(1,8),rep(2,8),rep(3,8)))
my_bar_stack_01 <- ms_barchart(data = summary, x = "TotalAssets",
y = "value", group = "variable")
my_bar_stack_01 <- as_bar_stack( my_bar_stack_01)
my_bar_stack_01 <- chart_ax_y(my_bar_stack_01,second_axis = FALSE)

doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_chart(doc, chart = my_bar_stack_01)
print(doc, target = "barchart_01_stacked.pptx")

ms_linechart does not work with non-numeric x axis

Hi David,

I was attempting to create a lineplot with the x axis defined as an ordered factor of month names -- minimal example:

td <- data.frame(x = factor(sample(c("June", "July", "August"), 20, replace = T), ordered = T), y = runif(20), group = sample(1:3, 20, replace = T))
pp <- ms_linechart(td, x = 'x', y = 'y', group = 'group')
print(pp, preview = T)

However this does not work, and rather than failing fast it instead returns a corrupted pptx file. Character vectors exhibit the same behavior.

Line width not changing

Using chart_data_line_width() to alter line width of a line chart does not seem to be working:

library(mschart)
library(tidyverse)

ms_linechart(data = iris, x = "Sepal.Length", y = "Sepal.Width", group = "Species") %>%
  print(preview = TRUE)

ms_linechart(data = iris, x = "Sepal.Length", y = "Sepal.Width", group = "Species") %>%
  chart_data_line_width(1) %>%
  print(preview = TRUE)

Both examples produce the same chart (with the default line width of 3.75).

It does work for scatter plots:

ms_scatterchart(data = iris, x = "Sepal.Length", y = "Sepal.Width", group = "Species") %>%
  chart_settings(scatterstyle="line") %>%
  chart_data_line_width(1) %>%
  print(preview = TRUE)

Thanks for investigating!

(Love the package btw!)

style = "none"

Hi, thanks for great package, but am I doing something wrong when trying to set axis_ticks = fp_border(style = "none").. how am I supposed to do when I don't want any tickmarks or axis lines?

Cheers

Ability to change border color / remove border on bars barchart

Hi!

Thanks for making an awesome package first off!

Bug / Enhancement

When using chart_data_fill() I am not able to change the color of the barchart border or remove it. There is a thin line around the bars that I can't find a way to remove.

Picture below
Capture

in chart_data_labels, num_fmt = arguments differ for different charts

Hi David,

It seems that the requirements for num_fmt string formatting are different for different chart types. For example, to get a percentage when passing chart_data_labels to a barchart requires two percent signs to avoid sprintf errors, without the same requirement in ms_linecharts

MWE:

library(mschart)
library(officer)

df <- data.frame(y = runif(10),
                 x = 1:10)

bar <- ms_barchart(df, y = 'y', x = 'x')

## fails
bar2 <- chart_data_labels(bar, num_fmt = "0.00%", show_val = T)
print(bar2, preview = T)

## succeeds
bar3 <- chart_data_labels(bar, num_fmt = "0.00%%", show_val = T)
print(bar3, preview = T)


line <- ms_linechart(df, y = 'y', x = 'x')

## succeeds
line2 <- chart_data_labels(line, num_fmt = "0.00%", show_val = T)
print(line2, preview = T)

## prints 'double percentages' (i.e. percent*100)
line3 <- chart_data_labels(line, num_fmt = "0.00%%", show_val = T)
print(line3, preview = T)

Documentation around ph_with_ul is not clear

So I was playing around with a Two Content slide yesterday which had four text boxes in total. I ended up using a combination of the output from layout_properties and trial and error to figure out what the index parameter should equal. I'm not sure whether it should be made clearer within layout_properties or the Roxygen documentation for ph_with_ul. Maybe both? But either way, it was not immediately clear how exactly to determine the index number. Some additional information to include would be something along the lines of what the index should be between, i.e. between 1 and the maximum number of elements in a slide. Something like that.

Maybe one idea would be to also accept the ph_label, i.e. Text Placeholder 2

Detail in readme example

Hi!

I tried to replicate the example but I had an error in the line:

doc <- ph_with_chart(doc, value = linec)

And seeing the documentation, the arg is called chart instead of value.

Thanks for the packages, looks good.

method to easily view a ms_chart object

When a presentation is being designed, analysts often like to view edits to graphs in their IDE, rather than having to generate a whole presentation to confirm each edit. To this end I believe that a view method for ms_charts would be really helpful. Something like in ggplot2, where calling a ggplot2 object by default plots it.

Ideal behavior would be to create and display a blank temporary ppt document, similarly to the below convenience function we've been using:

show_mschart <- function(ch){
  doc <- read_pptx() %>%
    add_slide(layout = "Title and Content", master = "Office Theme") %>%
    ph_with_chart(value = ch)
  print(doc, target = tempfile(fileext = ".pptx")) %>% browseURL()
}

No option of selecting a color scheme available in PowerPoint

There is no option/command available to select the style/themes/color schemes available in PowerPoint template.
If we have selected the master different from Office, be default, it should use the color schemes of that master in the charts, not the default Office theme.

ph_with_chart produces broken pptx

When following the example in the README using the most recent officer and mschart installs (versions 0.1.7.0002 and 0.1.1.9004 respectively) on Windows 7 running R 3.4.1 x64 the output PowerPoint file reports "PowerPoint found a problem with content in [location]. PowerPoint can attempt to repair the presentation. If you trust the source of this presentation, click Repair." When I repair it, the slide is completely empty.

I tried this with a custom theme first and thought it might be related to issue 43 in officer but the basic example failed too.

linec <- ms_linechart(data = iris, x = "Sepal.Length",
                      y = "Sepal.Width", group = "Species")
linec <- chart_ax_y(linec, num_fmt = "0.00", rotation = -90)

doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_chart(doc, chart = linec)

print(doc, target = "example.pptx")

Error plotting scatter plots with special characters ("&") in the data

"Error in doc_parse_raw(x, encoding = encoding, base_url = base_url, as_html = as_html, :
EntityRef: expecting ';' [23]"

This error seems to appear whenever certain special characters appear in the data. In the following example, I used the character string "&" as the column name of the data, and produced the error:

tibble("B&O"=1:10,"Bose"=sample(5:20,10,replace=TRUE)) %>%
ms_scatterchart(x="B&O",y="Bose") -> chart.xx
xx <- read_pptx()
layout_summary(xx)
xx <- add_slide(xx,layout="Title and Content",master="Office Theme")
xx <- ph_with_chart(xx,chart=chart.xx)

This is a minor issue that I can get around, but thought I'd report this anyway. Love this package, there is definitely a lot of potential for this because people continue to ask for PowerPoint reports due to its flexibility for non-technical users to make subsequent changes to the data. Also would look forward to data label editing functionalities (font size, etc.) in the future, if possible...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.