How to make Grafana panel with just colour and text as link? - grafana

I want to make a simple panel with just:
Text as a link to another dashboard
Background as traffic light colour based on a metric
Hidden underlying metric (do not want to see it)
Singlestat would be ideal but I can't see how to hide the metric or make text a link. Any ideas?
Thank you!

I have found a solution:
Use the SVG plugin (https://grafana.com/plugins/marcuscalidus-svg-panel)
Create an SVG rectangle with the text you want (eg. Google drawing & export)
Include a link in the SVG code (https://alligator.io/svg/hyperlinks-svg/)
Change rectangle colour based on metrics (code inside the Javascript area):
To find the metrics to add to javascript:
Use console.log(ctrl) to see what metrics are in your panel
The one I wanted was in ctrl.series[0].stats.current
..............................................................................
My javascript code:
var S = Snap(svgnode);
var c = S.select("#rect");
if (ctrl.series[0].stats.current > 10)
c.attr({"fill": "#DAF7A6"});
..............................................................................
Good website for an example.
https://community.hiveeyes.org/t/how-to-visualize-2-dimensional-temperature-data-in-grafana/974/6
Youtube video with something similar:
https://www.youtube.com/watch?v=aVS13Q36D34

Related

How to fill area between two line serie in tradingview api javascript

Hello I have been searching through the documentation and I didn't find any way to fill the area between two line series with a color I'm looking for something like the image below:
Actually, this feature is not available yet and there is a request for this feature on their GitHub :
https://github.com/tradingview/lightweight-charts/issues/140

How to create a custom settings control in Leaflet

I would like to add a custom container to Leaflet. The container would contain edit controls and would be used as a kind of properties editor in order to customize the map (marker colors, zoom level, polyline color, etc ...). The panel would be displayed when the user clicks on a "settings" button located on the map.
Is there a Leaflet plugin for this?
I also had a look at how to implement custom controls, but I am really not clear how to achieve this. In particular it seems to me that I can only use JavaScript and DOM manipulations (and no direct HTML markup) in order to create a custom control.
Could someone please help me bootstrap the control? thanks!
Edit:
So I tried to create a very simple container consisting of a single checkbox "control" as follow:
L.Control.SettingsPanel = L.Control.extend({
onAdd: function(map){
var checkbox = L.DomUtil.create('input');
checkbox.setAttribute("type", "checkbox");
checkbox.style.width = '200px';
return checkbox;
}
});
L.control.settingsPanel = function(opts){
return new L.Control.SettingsPanel(opts);
}
The sidebar v2 leaflet plugin might be what you are looking for.

How can I maintain image class when using mc:edit in a MailChimp template?

I'm trying to create a MailChimp template where an image is editable using mc:edit
Here's the code:
<img class="flexibleImage" mc:edit="top_image">
This seems all good, but once I edit this image using the MailChimp editor, I lose the original class "flexibleImage" and all other class and style info related to that img element.
How can I create a template with an editable image and maintain (or add) that class?
For anyone else with the problme, this answer is based on a response from MailChimp support:
It looks like it isn't possible to keep a custom class attached to an
editable image. What you could do instead though is apply the class
to the image's containing element. So if the image is in a <div>, add
flexibleImage to the div, and then update your CSS rules to point to
.flexibleImage>img.
This happens because the image you want to edit is inside an mc:repeatable block that in turn is inside another mc:repeatable block
Even four years later this is still an issue.
The other route is to put mc:edit on the parent container, and have images managed through there, but you lose the Image uploader box, which is poor user experience.
You can go into Settings when you have uploaded a new image and put the sizes in there. Not ideal, but Mailchimp is to blame here (no such issue on Campaign Monitor templates).

How to make an interactive tree chart with d3?

Is there any sample of how one could design an interactive tree chart like in the pearltrees.com web site (see here for example) with D3 ?
thanks for any help !
You can create a force-directed graph to do something like this:
http://mbostock.github.com/d3/talk/20110921/#20
You would have a bit of work to do:
Add images dynamically to the nodes (this example adds a favicon to each node)
Allow users to expand/collapse parts of the tree. (this example does this, but uses a tree layout).
Add HTML links to the end nodes (this example shows how nodes can link out to other pages).

What is the best way to enable content authors to add images with captions in Expression Engine

There's a module to do this in Drupal land, but I've been frustrated with the hacks that've been necessary in Wygwam. What is the best way to go about implementing this in such a way that you don't need to totally override the default image handling in ChannelImages/Wygwam?
Assets is a good suggestion, but I believe Devdemon's channel images might be a better fit for the workflow you're suggesting.
http://www.devdemon.com/channel_images/
Clients can add (and see) a caption and more and it's fully integrated with Wygwam and other editors. Devdemon's support is also excellent.
The Assets module from Pixel & Tonic allows you to double-click on the image (or any other file) and add metadata. You then have access to the metadata in your templates.
Check the screenshot: http://pixelandtonic.com/assets
You can also add metadata using the native File Manager. Click the edit icon from the File Manager and you'll see a few fields. You can use the File Entries tag to access it.
http://expressionengine.com/user_guide/modules/file/file_tag.html
I typically use Matrix with one column for the image, one column for the caption, and if a link is needed another column for the link. This of course works best if the image is in a fixed location within your template.
On possible way to accomplish this that I have used is to run some jQuery that looks for images within a certain area, and if they have alt attributes, rewrite the image tag within a tag with a tag inside.
so:
jQuery(document).ready(function() {
$('#page-content > .wrapper img').each(function(){
if($(this).attr('alt') !== undefined && $(this).attr('alt').length > 0){
if(!$(this).parent().hasClass('content-image')){
$(this).replaceWith("<figure class='content-image "+$(this).attr('class')+"'>"+$($('<div></div>').html($(this).clone().attr('class',''))).html()+"<figcaption>"+$(this).attr('alt')+"</figcaption></figure>");
}
}
});
});
will do just that. It's looking within a #page-content div for img tags with alt attributes. And then rewriting it as
<figure><img src='....' .... /><figcaption>This is the text that was in the alt attribute</figcaption></figure>
Soooo, that kinda works. The only caveat is that you had better not use any double-quotes within your alt text, or it will break thangs. Not the cleanest of solutions, but a solution, nonetheless.