How do I flip the orientation of a grid? - rotation

I'm just doing a simple Grid[datasymbolgoeshere, Frame->All] command. It's taking a list of ID numbers (e.g., {11282,11281,11280}) and placing each one in its own column. I just want to flip the orientation so all strings in a single list are placed in the same column (individual rows, one on top of another), and the next list of strings goes in the second column.

Sounds like you want
Grid[Transpose[datasymbolgoeshere],Frame->All]
Edit -- by the way Grid assumes a multidimensional list. It won't complain if you call, eg Grid[{1,2}] but Mma cannot simplify that expression and just returns it as-is. Grid will work with a ragged array, but Transpose will complain, so you will need to pad the elements of datasymbolgoeshere to make your array rectangular.
Putting it all together, something like this should work on most inputs
With[
{
maxLength=Length/#data//Max
},
PadRight[#,maxLength,""]&/#data//Grid[#,Frame->All]&
]

Rotate[Grid[datasymbolgoeshere, Frame->All],90 Degree]
I like that the contents are still selectable.

Related

D3JS Change TSV Data Column Ordering

I've just draw a stacked-area-chart with D3JS.
This is my referral implementation
I also need to dynamically swap the ordering of the layers.
I think that there isn't a way to do it dynamically without redrawing (or is there any? :D )
Actually i'm trying to map the data to a new header column, but this implies the redrawing.
Let me show you an example:
Here is the TSV header ['date', 'columnA', 'columnB', 'columnC']
Every column, except of 'date', represent the % of area for that sample.
I would like to dynamically rearrange the area layers, but I'm pretty sure that I also need to parse again the data with a new header
eg: ,
['date', 'columnA', 'columnB', 'columnC']
-map to-
['date','columnB', 'columnC', 'columnA']
and then draw the result.
I'm doing it right? Thanks for your support, cheers.
This is the line that defines the array that will be passed to the stack() function:
var keys = data.columns.slice(1);
Right now, this is the array:
["Google Chrome","Internet Explorer","Firefox","Safari","Microsoft Edge","Opera","Mozilla","Other/Unknown"]
But you can sort it anyway you want. For instance, sorting by alphabetic order:
keys.sort();
Which gives us:
["Firefox","Google Chrome","Internet Explorer","Microsoft Edge","Mozilla","Opera","Other/Unknown","Safari"]
Here is the result: https://bl.ocks.org/anonymous/6a339ed0731a70bb234af150ee6b4a99
Here is another one, with a random permutation (refresh the page to see diferent orders): https://bl.ocks.org/anonymous/662f99901219b8907030ec3c84363f3a
Pay attention to this: the order in the stacked area chart is now different, but the colours don't keep the same for each browser (that is, each stacked area). That's because d3.scaleOrdinal(d3.schemeCategory10) assigns the colours in a first-come, first served basis.

Neat block-collapse - how to use - what's its purpose

I'm kind of confused how the neat grid works when using block-collapse - assuming a 3 column grid, the first two column result in a width of something like 34....% and the third column is around 31...% so I'm not getting three equal columns next to each other.
am I missing something here?
block-collapse removes the margin gutter, and adds it to the block. This works across the row until the end, when the final block just takes up the remaining space. This is why you are seeing a smaller last column.
If you have a row, and set that to $display: table, then children of it will be displayed as table cells, which will give you an even distribution across the row which I think is what you are after.
Pen is here:
http://codepen.io/mikehdesign/full/jPmWza/
Here is an image showing a standard set of columns, block-collapse and a table display:

How do I combine four countif and add them all in one cell?

Hi guys I'm trying to combine different things together then I want to add them all together in one cell. Right now there all in separate cells.I tried just about everything I know, but nothing. i haven't done this kind complex formulas since 2007. How would I combine these?
=countif(b5:b32,"*")*5
=countif(c5:c32,"*")*5
=countif(d5:d32,"*")*10
=countif(f5:f32,"*")*20
=sum(b33,c33,d33,f33)
(Ps everything in the cells have dates I formatted the cells to text and formatted the cell that adds all of them to currency (g33). Also I formatted the cells that do the countif function to general just so it adds the cells and not date. My dates are in this format dd/mm/yyyy)
Just replace the cells references in the SUM formula with the formula in each cell. Use this formula:
=SUM(
COUNTIF(B5:B32,"*")*5,
COUNTIF(C5:C32,"*")*5,
COUNTIF(D5:D32,"*")*10,
COUNTIF(F5:F32,"*")*20)

Conditional formatting based on validation errors

I have a drop down box and old data in the sheet that doesn't match up to the drop down box list needs to be added to my conditional formatting so the cell stands out a bit better.
Is it possible to set the conditional formatting of a cell based on whether or not the cell has a validation error?
It is impossible to do that the way you want, but there is a workaround.
You can use conditional formatting with a custom formula.
If you data validation is from a range, use that range. If it is from a list, create a range with that list.
For example a range on Sheet2 A1:A10 has the values that are used in data validation. You want to format the range Sheet1 B:B based on values found in that range.
First, select the column in your table(or the whole table) and colour it Red. Then use Conditional Formatting with the following custom formula to colour everything that matches White
=COUNTIF(INDIRECT("Sheet2!$A$1:$A$10"),"="&B1)
You can also add another conditional formatting to colour all the empty cells as white if you have empty space after your table
Good stuff! It took me a while but I found that this formula works and will color the cells that are not in the range AND do not have a blank cell at the first column. This is good to spot data validation errors and works better than looking for a little tiny triangle at the top right of each cell.
=AND(NOT(COUNTIF($M$3:$M$40, H3)),A3<>"")
This worked for me.
Under conditional formatting, new rule, use formula.
=IF(OR(A2="valid data 1",A2="valid data 2"),"FALSE","TRUE")
Then set error condition.

mixing float-span() and grid-span() in same context?

ahoy all,
i have a simple example that mixes float-span and grid-span mixins within the same grid context (i.e. the same number of columns in the same row)
http://sassbin.com/gist/7812502/
as you can see, i have 3 items that i want to space out evenly in a row. i use float-span with first and last options on items 1 and 3 to make them sit at the beginning and end of the row respectively, and this works as expected. for the middle item, which i want centered, i assumed i could use grid-span with the correct location to have the 2nd item in the middle. however, what is happening is that the counting of location for grid-span is started after the column taken up by the first floated item. is this expected behavior? in other words, is it allowable to mix float-span and grid-span in the same grid context/row? and if not, what is the preferred way in Singularity for accomplishing the same thing?
i have been searching the documentation wiki, in particular the section on spanning the grid, but have found no statements either way. and the demos do not seem to be using float-span and grid-span together.
thanks as usual for Singularity and for any help.
peace
PS. i have already tried using the isolation-span mixin in place of grid-span with the same results.
It is not advisable to mix output styles like float and isolation in the same grid. You should pick either isolation or floats and stick with it.
Here is your sassbin tweaked a bit: http://sassbin.com/gist/7815953/

Resources