Legend and controls overlapping at rcharts - r-markdown

I have been trying to deal with the overlapping on legend and control using rcharts in slidify. The behavior under Chrome look like:
https://codemorecode.wordpress.com/2015/03/04/legend-and-controls-overlapping-at-rcharts/
However any change to metadata in the YAML front matter doesn't work. Any advice I'll very thankful. Cheers,
Juan-Carlos
Below is my yaml:
`---
title :
subtitle : AAD-UTAS PhD Program in Quantitative Antarctic Science (QAS)
author : Juan-Carlos Quiroz
job : March, 2015
framework : io2012
highlighter : highlight.js
hitheme : tomorrow
widgets : [bootstrap, quiz, interactive, shiny]
mode : selfcontained
knit : slidify::knit2slides
logo : aad.png
biglogo : utas.jpg
license : by-nc-sa
ext_widgets : {rCharts: [libraries/nvd3, libraries/morris]}
runtime : shiny
---`

A way to avoid this problem is save your multiBarChart into an html file (you have 2 options cdn or standalone). The generated html file does not have any problems with controls overlapping. For example:
r1 = nPlot(Catch ~ Years, group = "Class", data = database, type = "multiBarChart")
r1$xAxis(axisLabel = 'Years')
r1$yAxis(axisLabel = 'Catch (tons)', width = 55)
r1$yAxis(tickFormat = "#! function(d) {return d3.format(',.2f')(d)} !#")
#r1$save('mydata.html', cdn = TRUE)
r1$save('mydata.html', standalone = TRUE)
Then you will need to reference the html file into your rmd file like:
---
## Embedded html
<iframe width="800" height="400" src = 'assets/mydata.html'></iframe>

Related

Confluence REST search API could not parse cql

In [50]: r = confluence.search(cql=f'title contains "Agent Alert - {event_name}" and label = "agent-event"')
# prints the params of the request
{'cql': 'title contains "Agent Alert - SYS_THRESHOLD_REACHED" and label = "agent-event"', 'expend': 'body.view'}
And I get this error
In [49]: r.content
Out[49]: b'{"statusCode":400,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"Could not parse cql : title contains \\"Agent Alert - SYS_THRESHOLD_REACHED\\" and label = \\"agent-event\\"","reason":"Bad Request"}'
However I tried using the exact string in confluence webUI and it works.
Managed to work it out...
it doesn't seem to like contains in the API, so have to use ~
the spaces need to be replaced with + within the title search
so turned out this is what is accepted
title~"Agent+Alert+-+SYS_THRESHOLD_REACHED" and label="agent-event"

How to use constants in Fluid templates?

I'm using Typo3 version 10+
I created a "Site package extension" to make some nice templates and styles (header / footer / etc)
I'm using constants like this (constants.typoscript):
#cat=My website variables//a; type=string; label=Some id value
config.some_id = 123
BE User can edit the constant in BE.
To use the constant in fluid template, I use this typoscript code (setup.typoscript)
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
variables {
some_id = TEXT
some_id.value = {$config.some_id}
}
}
...
}
In fluid (footer.html) I use this variable:
<f:link.page pageUid="{some_id}">Some link</f:link.page>
Everything works very nice so far.
Now I'm creating a new extension to output some simple events "Events ext" (list / details)
Now question: is it possible to use this constant (some_id from Site package ext) in the Events extension (List.html) as global variable ?
For some reason I can't see any constants in fluid templates of "Event ext". (empty values)
For both extensions I used the code below and included its configs in Typoscript setup
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
$extensionKey,
'Configuration/TypoScript',
'My ext'
);
Constants defined through page.10.variable are only available for page template, not in your extension template.
But you can easily access this variable in your extension with some TypoScript.
Add this TS - in your my_ext/TypoScript/setup.typoscript or through BE in template setup field :
plugin.tx_you_ext.settings {
some_id = {$config.some_id}
}
And then, you can access the data in your Fluid Template with :
{settings.some_id}

Suppressing messages in Rmarkdown using sink()

I am writing a Rmarkdown document about a package called SparseTSCGM and have trouble suppressing messages generated by functions in this package. The messages I'm referring to can be generated by the following code:
if(!require(SparseTSCGM)) install.packages('SparseTSCGM')
library(SparseTSCGM)
datas <- sim.data(model="ar1", time=10,n.obs=10, n.var=5, prob0=0.35,
network="random")
res.tscgm <- sparse.tscgm(data=datas$data, lam1=NULL, lam2=NULL,nlambda=NULL, model="ar1", penalty="scad",optimality="bic_mod", control=list(maxit.out = 5, maxit.in = 5))
I have tried using the functions invisible() and suppressMessages() but these do not help in either Rmarkdown or the R console. I also tried adding the option message = FALSE as follows:
```{r message=FALSE}
library(SparseTSCGM)
datas <- sim.data(model="ar1", time=10, n.obs=10, n.var=7, prob0=0.35, network="random")
res.tscgm <- sparse.tscgm(data = data.fit, lam1 = NULL, lam2 = NULL, nlambda = NULL, model = "ar1", penalty = "lasso", optimality = "bic", control = list(maxit.out = 10, maxit.in = 100))
```
but this does not help.
I have found that I can suppress output in the R console using sink('NUL') (I'm working on a Windows system), but this approach does not work in Rmarkdown. When I try this approach the message I tried to suppress is still there but the Rmarkdown console gives a warning: "Warning message: In sink() : no sink to remove".
Does sink() not work with Rmarkdown, is there another way do to this? If there is no solution I can always manually remove the section from the HTML file but that's a last resort.

SharePoint List CSR handler are not fired - SharePoint online

I am trying to change style of sharepoint list using CSR. I want to apply bold to title column. I have added these code in JS file and reffered as JSLink(JavaScriptDisplayTemplate) to webpart. On document ready both renderTitleHandler & preRenderHandler are registered and also preRenderHandler are called successfully. But renderTitleHandler are not fired.
Please find my code snippet,
function renderTitleHandler(ctx) {
var fieldVal = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
var title = fieldVal.toString();
var html = '';
html += '<b>' + title + '</b>';
return html;
}
function preRenderHandler(ctx) {
ctx.ListTitle = '<b>' + ctx.ListTitle + '</b>';
}
(function() {
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.OnPreRender = preRenderHandler;
overrideCtx.Templates.Fields = {
"Title" : {"View" : renderTitleHandler}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
})();
Thanks in advance.
Kannan.
Possibilities:
disable Minimal Download Strategy (mds). Sometimes this blocks your
javascripts caused by the async loading in the back of certain OOTB
scripts
remove the debugger;-line (is it possible that your code works when developer tools in your browser are open?)
Edit:
Found an example on my dev environment and i have the word View between quotes:
linkFilenameFiledContext.Templates.Fields = {
"Title": { "View": renderTitleHandler}
};
Hope it helps

How to make an text Hyperlinked using Aspose.Words DOM approach?

I am trying to create a Word document using Aspose.Words for .NET using the DOM approach. How would I make an text hyperlinked?
Like when we click on text it should be route to web page from Docx.
Example : click here
This can be done by appending a hyperlink field to the paragraph. See the below sample code
// Create or load a document
Aspose.Words.Document wordDoc = new Aspose.Words.Document();
// Get first paragraph
Aspose.Words.Paragraph para = wordDoc.FirstSection.Body.FirstParagraph;
para.Runs.Add(new Run(wordDoc, "Visit "));
// Add the hyperlink field to the paragraph
FieldHyperlink field = (FieldHyperlink)para.AppendField(Aspose.Words.Fields.FieldType.FieldHyperlink, false);
// URL
field.Address = #"""http://www.aspose.com""";
// Text
field.Result = "Aspose";
field.Update();
// Set color of the last run
para.Runs[para.Runs.Count - 1].Font.Color = System.Drawing.Color.Blue;
// Save the document
string dst = (dataDir + #"hyperlink.docx");
wordDoc.Save(dst);
I work with Aspose as Developer Evangelist.