animation: remove dots keep control panel - r

I've been playing with the animation package lately. Pretty nifty stuff but in the use of saveHTML I get a control panel with a green dot for every image (see below) and I have a ton of images. How can I make the green dots go away but keep the control panel?
I asked a related question yesterday so the minimal working example is there (my data set and mnel's answer).
Here's the code I'm using to make the html file:
saveHTML(pp(), autoplay=FALSE, loop=FALSE, verbose=FALSE, outdir = "new")
The animation help manual says see the reference for a complete list of available options but I can not figure out how to do what I've asked above.

You want to remove the 'navigator' option from 'controls'. Try adding this to the parameter list: single.opts = "'controls': ['first', 'previous', 'play', 'next', 'last', 'loop', 'speed'], 'delayMin': 0"
to get something like:
saveHTML(pp(), autoplay=FALSE, loop=FALSE,
verbose=FALSE, outdir = "new",
single.opts = "'controls': ['first', 'previous', 'play', 'next', 'last', 'loop', 'speed'], 'delayMin': 0")
The default list includes 'navigator' so we're just removing that option. You can reorder these options too if you want.

Related

Change the background color of search box and entry box in a datatable

I would like to change the background color of the 'number of entries' and 'search box' at the top of the data table from white to -lets say- gray. Is this possible?
library(DT)
datatable(iris)
library(DT)
callback <- c(
"$('#DataTables_Table_0_length select').css('background-color', 'orange');",
"$('#DataTables_Table_0_filter input').css('background-color', 'yellow');"
)
datatable(iris, callback = JS(callback))
Use callback argument:
Write JavaScript to select the HTML elements and change their CSS.
For example, I modified the background color using codes below. You can use similar approach to change the CSS of the search box.
DT::datatable(iris,elementId = "thistable",
callback = DT::JS("$('#thistable div[role=\"status\"]').css('background-color','red')"))

Modify a function in an R package to fit for purpose

The shinydashboard package has three types of menus – messages, notifications, and tasks. I want to use the notifications menu for alerts. But I have to make some modications to the function. The image below is a demo of the notification menu from the package website (link). I want to remove the line that says "you have 3 notifactions" or change it to "you have three alerts". I want also to disable the toggle functionality and repalce the three icons at the top by "Today's Alerts" or something similar. The function to do this in the "dropdownMenu" function in shinydashboard. I can see the function source code by using
library(shinydashboard)
body(dropdownMenu)
but need help how to edit and use the modified source code.
I had to solve a similar problem in revising the answer I made for More efficient plot functions in R when millions of points are present?. Here's a version which is adapted to your needs:
my_dropdownMenu = function(...,
type = c("messages", "notifications", "tasks"),
badgeStatus = "primary", icon = NULL, .list = NULL)
{
message("Got here!")
# ...
# (COPY AND PASTE body(mydropdownMenu) HERE)
# (and then make your modifications)
}
# helper function, see
# https://stat.ethz.ch/pipermail/r-help/2008-August/171217.html
rebindPackageVar = function(pkg, name, new) {
# assignInNamespace() no longer works here, thanks nannies
ns=asNamespace(pkg)
unlockBinding(name,ns)
assign(name,new,envir=ns,inherits=F)
assign(name,new,envir=globalenv())
lockBinding(name,ns)
}
# make sure we can call non-exported functions (like validateStatus())
environment(my_dropdownMenu) = asNamespace("shinydashboard")
# now rebind the dropdownMenu function
rebindPackageVar("shinydashboard", "dropdownMenu", my_dropdownMenu);
Example output. The "Got here!" shows us that our modified version is being executed, and the rest is the normal output of the function:
> dropdownMenu()
Got here!
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope"></i>
...

Bootstrap-select - Don't show selected value

I'm using bootstrap-select to create my selectpicker.
I set an icon for the select using :
data-style="glyphicon glyphicon-list"
When I'm selecting an option, the option selected is place near the icon but I don't want that.
I don't want to see the selected option, only the icon.
Two printscreen to illustrate :
Before =>
http://hpics.li/07182fd
After =>
http://hpics.li/c1dd1ca
Thank you !
I found a way !
My code :
$('select.selectpicker').on('change', function(){
$(".glyphicon-list .filter-option.pull-left").empty();
});
glyphicon-list is the class of the button.btn.dropdown-toggle.selectpicker.

Customising Wordpress Color Picker

Is there any way to customize the Wordpress 3.8 color picker (on the custom field types) to use only colors i will define?
I need to have only 6 colors for a client, but they do not want to have all those colors, apart from 6 gradient colors.
Will be greatful for any help... I have been trying to do it for several days, but no positive solution:(
Thank you
Wordpress 3.5+ uses the Iris colorpicker which has several options available for use.
When initializing the object just assign the palettes option with an array of colors.
var colorOptions = {
// show a group of common colors beneath the square
// or, supply an array of colors to customize further
palettes: ['#4444,44','#ff2255','#559999','#99CCFF','#00c1e8','#F9DE0E','#111111','#EEEEDD']
};
jQuery('.my-color-picker-class').wpColorPicker(colorOptions);
If your using TinyMCE editor you can modify the color palette like so.
function my_mce4_options( $init ) {
$custom_colours = '
"e14d43", "Color 1 Name",
"d83131", "Color 2 Name",
"ed1c24", "Color 3 Name",
"f99b1c", "Color 4 Name",
"50b848", "Color 5 Name",
"00a859", "Color 6 Name"
';
$init['textcolor_map'] = '['.$custom_colours.']';
// Set number of color rows
$init['textcolor_rows'] = 3;
// Set number of color columns
$init['textcolor_cols'] = 2
return $init;
}
add_filter('tiny_mce_before_init', 'my_mce4_options');
We need to wp_enqueue_script the script and wp_enqueue_style the style with add_action to the functions.php file. Just include a jQuery file and stylesheet file by this script.
// Register Scripts & Styles in Admin panel
function custom_color_picker_scripts() {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 );
wp_enqueue_script( 'cp-active', plugins_url('/js/cp-active.js', __FILE__), array('jquery'), '', true );
}
add_action( 'admin_enqueue_scripts', custom_color_picker_scripts);
Now create a new javascript file as like cp-active.js and keep it avobe defined “/js/cp-active.js” file path using bellows code.
jQuery('.color-picker').iris({
// or in the data-default-color attribute on the input
defaultColor: true,
// a callback to fire whenever the color changes to a valid color
change: function(event, ui){},
// a callback to fire when the input is emptied or an invalid color
clear: function() {},
// hide the color picker controls on load
hide: true,
// show a group of common colors beneath the square
palettes: true
});
Add a textbox to your settings page with a CSS class for the color picker, where you want to dispaly the input text. I have use “color_code” for input $variable.
<input id="color_code" class="color-picker" name="color_code" type="text" value="" />
Please see more details on Add jQuery Color Picker WordPress Theme or Plugin
Here's a quick & dirty solution:
Go to wp-admin/js/iris.min.js
Search the palette colors there (about 1/3 from the beginning of the file). I found this:
_palettes:["#000","#fff","#d33","#d93","#ee2","#81d742","#1e73be","#8224e3"]
Replace these defaults with your own custom colors. I left black and white and then added our brand colors instead of #d33 and the rest.
Upload to server.
Works for now. But haven't tried yet if this survives the next Wordpress update.

PHPExcel: Coloring the cells?

I'm using the PHPExcel to generate some sheets on my server. More or less it everything works fine, but, when I try to color some rows (every second row, so the list would be easily readable) I get funny thing: the row is colored ok, but only on cells that are not filled with data. The cells that are filled with data remain white.
Here's code I use
$ind = ($ind + 1) % 2;
if($ind == 1)
{
$style_header = array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('rgb'=>'CCC'),
),
'font' => array(
'bold' => true,
)
);
$sheet->getStyle($row)->applyFromArray( $style_header );
}
$sheet->getCellByColumnAndRow(0, $row)->setValue($item['qty']);
$sheet->getCellByColumnAndRow(1, $row)->setValueExplicit($item['name']);
$sheet->getCellByColumnAndRow(2, $row)->setValueExplicit($item['size']);
$sheet->getCellByColumnAndRow(3, $row)->setValueExplicit($item['color']);
What am I doing wrong?
I don't see anything that jumps out at me as being wrong. Does the bold font get applied to the cells with text or is the entire style being ignored? If the bold does get set, try flipping the order of 'fill' and 'font' within the array. I wouldn't think that should make a difference, though.
You could also try $sheet->getStyle('A$row:D$row')->... as well, just to explicitly set the style for the range of cells you're using instead of the whole row.
here you can get good examples
http://bayu.freelancer.web.id/2010/07/16/phpexcel-advanced-read-write-excel-made-simple/

Resources