d3.js - Fixed font-size from an array - D3 Jason Davies Example -


The code below is the Wordcloud example of Jason Davis, I want to insert an array with fixed font size and make it random I want to integrate with

For example:

  fontSize = [20,35,50,60,83,90];   

I want to fix it, as above (not from the limit of [x, x]):

  var fontSize = d3 Scale.log () .ange ([20, 90]);   

Someone knows how I can implement it.

Sorry, maybe this is a stupid question, unfortunately still a start.

  & lt; Script & gt; Var fill = d3.scale.category20 (); ("[", " Map (function (d) {return {text: D, size: 10+ math.rondam () * 90};}) .tate (function () {return ~ ~ (monastery) . Randem) () * 2) * 90;}). Font ("effects") Fonts (function (D) {return ds;;}) .n ("end", draw). Start (); ("Width", 800) .attr ("height", 800). Style ("font size", function (d) {return d. ("Text"). Size + "px";}) style ("font- Style "," effect "). Style (" fill ", function (d, i) {return filled (i);}) .attr (" text-anchor ("+ D.rotate +") ";}) Txt (function) (d) {return dtext;});}    

Thanks!

< Div class = "post-text" itemprop = "text">

All you need to do is to use words to fix those shapes that you want them to play randomly. You can add them to the array with random size:

  var word = ["hello", "world", "normally", "you", "desired", "more "," (Text: D, size: 10 + Math.rendum () * 90};}; words; push ({text: "foo" word, "" "," to "," this "] ., Size: 20}); words.push (...);   

The rest of the code should not require any modification. The code you posted does not use Any scales, therefore, the size of the font that you generate and the specifications Do they really need the font size to be used.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

java - Reaching JTextField in a DocumentListener -

c# - Add Image in a stackpanel based on textbox input -