JavaScript Chart.js – Custom data formatting to display on tooltip

For chart.js 2.0+, this has changed (no more tooltipTemplate/multiTooltipTemplate). For those that just want to access the current, unformatted value and start tweaking it, the default tooltip is the same as: options: { tooltips: { callbacks: { label: function(tooltipItem, data) { return tooltipItem.yLabel; } } } } I.e., you can return modifications to tooltipItem.yLabel, which … Read more

Why does HTML5 recommend putting the code element inside pre?

<code> represents only a “fragment of computer code”. It was originally thought for simple code snippets like i++ or <code>. <pre> “represents a block of preformatted text, in which structure is represented by typographic conventions rather than by elements”. It’s original purpose was nothing more than exactly this: provide a text in the same way … Read more

How to blog code at wordpress.com [closed]

See here: http://en.support.wordpress.com/code/posting-source-code/ Wrap your code in these tags: [sourcecode language=”css”] .. [/sourcecode] (or shorter [code lang=’css’] .. [/code] ) Note that Visual Editor doesn’t interpret the tags, you need to click Preview to see how it works. Available language codes: actionscript3 bash clojure coldfusion cpp csharp css delphi erlang fsharp diff groovy html javascript … Read more

How do I set up VSCode to put curly braces on a new line?

Follow the steps below to make Visual Studio Code format opening curly braces on a new line for Java Script and Type Script. In Visual Studio Code (v1.20.0) Go to File\Preferences\Settings Add the following lines in ‘User Settings‘ (in the right side pane) “javascript.format.placeOpenBraceOnNewLineForControlBlocks”: true, “javascript.format.placeOpenBraceOnNewLineForFunctions”: true, “typescript.format.placeOpenBraceOnNewLineForControlBlocks”: true, “typescript.format.placeOpenBraceOnNewLineForFunctions”: true, Save ‘User Settings‘ and … Read more

Clang-format line breaks

So, having messed around in the clang format code and made some patches, here’s my two cents: Clang format is based on, parsing the AST using libclang, which basically eliminates all whitespace breaking up the token sequence into “unwrapped lines” which are like “logical” code lines Applying rules / configuration info to sometimes split up … Read more