Vertical-inclied list of elements ( or divs) - AngularJS - css

I have a list of 15 elements, which I am repeating through with ng-repeat. I would like to display them as a list or divs is kinda of a weird order like this(each number represents the 'index'):
1 4 7 10 14
2 5 8 11 12
3 6 9 13 15
they have to be indented just like this.
Is there any way to do this with angular/bootstrap/css rather than splitting things up on API side?

Solved it myself in very tricky(API side would be the best solution) way but it's working - so I will write the answer if anyone would be looking. I wrote 3 ng-repeats and I am showing only with $index that I would like to. So for the first line that would be : {{$index}}

Related

ggplot2 barplot where categorical variable has three components

New to the R/ggplot.
I have a data set like this. Each mol-code is made of 3 components and copies represent how many times each mol-code appears. There are 8 unique components available and it is represented as smile files.
full.mol.code2 Copies Pair1.Acids Pair2.Acids Pair3.Acids
1 1.301241e+23 18 OC(C1=COC(CCl)=N1)=O OC(C1=CC=C(CCl)C=C1)=O O=C(O)C1=C(C)OC=C1
2 1.303241e+23 18 OC(C1=CSC(CCl)=N1)=O OC(C1=CSC(CCl)=N1)=O OC([C#H](C)Br)=O.[R]
3 1.301241e+23 17 OC(C1=COC(CCl)=N1)=O OC(C1=COC(CCl)=N1)=O O=C(O)C1=C(C)OC=C1
4 1.304241e+23 12 ClC/C(C)=C/[C##H](C)C(O)=O OC(C1=COC(CCl)=N1)=O OC([C#H](C)Cl)=O.[S]
5 1.309240e+23 12 OC(C1=CSC(CCl)=N1)=O OC(C1=CC=C(CCl)C=C1)=O O=C(O)C1=C(C)OC=C1
6 1.301241e+23 11 OC(C1=COC(CCl)=N1)=O OC(C1=CC=C(CCl)C=C1)=O OC([C#H](C)Cl)=O.[S]
Edit: thanks Allan for formatting this properly.
'full.mol.code2' is a number like this (130124051501260617102804), it will not be considered as value.
I want to represent this data in a barplot where x-axis will be mol-code and y-axis represents copies and each bar represent the combination of three components in different color.
I hope that made sense and appreciate any help.
Thanks.

Am I at the deepest hierarchical grouping

I'm working on a Crystal report which is grouped hierarchically. Sometimes the data goes down to a fifth-level grouping, sometimes only a 4th. I'd like to be able to tell if I'm at the deepest level of the tree, so that I can switch from using the data in the group header to using the data in the detail line, setting it to columns. I've tried to use the Maximum() function to see how deep the tree goes, but that requires a field, not just an expression.
I've also tried writing a hierarchical query in Oracle and using the MAX OVER (PARTITION BY parent) clause, but that's only bringing back the data I already have, and in addition, it seems to be forcing me to lose the level-1 lines.
ETA: I have checked the GroupingLevel and HierarchyLevel functions, but those don't seem to help -- they only tell me where I am, not where I'm going. When I said above that I used Maximum(), I should have clarified I meant Maximum(HierarchyLevel(blah)).
ETA2: Ok, say the data looks like this:
id parentid
1
2 1
3 2
4 3
5 3
6 1
7 6
8 7
9 8
10 8
11 8
I want something that will return True for 4, 5, 9, 10, and 11, because that's as far down the tree as I can go.

Sorting data in R

I have a dataset that I need to sort by participant (RECORDING_SESSION_LABEL) and by trial_number. However, when I sort the data using R none of the sort functions I have tried put the variables in the correct numeric order that I want. The participant variable comes out ok but the trial ID variable comes out in the wrong order for what I need.
using:
fix_rep[order(as.numeric(RECORDING_SESSION_LABEL), as.numeric(trial_number)),]
Participant ID comes out as:
118 118 118 etc. 211 211 211 etc. 306 306 306 etc.(which is fine)
trial_number comes out as:
1 1 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 2 2 20 20 .... (which is not what I want - it seems to be sorting lexically rather than numerically)
What I would like is trial_number to be order like this within each participant number:
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 ....
I have checked that these variables are not factors and are numeric and also tried without the 'as.numeric', but with no joy. Looking around I saw suggestions that sort() and mixedsort() might do the trick in place of 'order', both come up with errors. I am slowly pulling my hair out over what I think should be a simple thing. Can anybody help shed some light on how to do this to get what I need?
Even though you claim it is not a factor, it does behave exactly as if it were a factor. Testing if something is a factor can be tricky since a factor is just an integer vector with a levels attribute and a class label. If it is a factor, your code needs to have a call to as.character() nested inside the as.numeric():
fix_rep[order(as.numeric(RECORDING_SESSION_LABEL), as.numeric(as.character(trial_number))),]
To be really sure if it's a factor, I recommend the str() function:
str(trial_number)
I think it may be worthwhile for you to design your own function in this case. It wouldn't be too hard, basically you could just design a bubble-sort algorithm with a few alterations. These alterations could change each number to a string, and begin by sorting those with different numbers of digits into different bins (easily done by finding which numbers, which are now strings, have the greatest numbers of indices). Then, in a similar fashion, the numbers in these bins could be sorted by converting the least significant digit to a numeric type and checking to see which are the largest/smallest. If you're interested, I could come up with some code for this, however, it looks like the two above me have beat me to the punch with some of the built-in functions. I've never used those functions, so I'm not sure if they'll work as you intend, but there's no use in reinventing the wheel.

simple rank formula

I'm looking for a mathmatical ranking formula.
Sample is
2008 2009 2010
A 5 6 4
B 6 7 5
C 7 8 2
I want to add a rank column for each period code field
rank
2008 2009 2010 2008 2009 2010
B 6 7 5 2 1 1
A 5 6 4 3 2 2
C 7 2 2 1 3 3
please do not reply with methods that loop thru the rows and columns, incrementing the rank value as it goes, that's easy. I'm looking for a formula much like finding the percent total (item / total). I know i've seen this before but an havning a tough time locating it.
Thanks in advance!
sort ((letters_col, number_col) descending by number_col)
As efficient as your sort alg.
Then number the rows, of course
Edit
I really got upset by your comment "please don't up vote this answer, sorting and loop is not what I'm asking for. i specifically stated this in my original question. " , and the negative votes, because, as you may have noted by the various answers received, it's basically correct.
However, I remained pondering where and how you may "have seen this before".
Well, I think I got the answer: You saw this in Excel.
Look at this:
This is the result after entering the formulas and sorting by column H.
It's exactly what you want ...
What are you using? If you're using Excel, you're looking for RANK(num, ref).
=RANK(B2,B$2:B$9)
I don't know of any programming language that has that built in, it would always require a loop of some form.
If you want the rank of a single element, you can do it in O(n) by looping through the elements, counting how many have value above the given element, and adding 1.
If you want the rank of all the elements, the best (and really only) way is to sort the elements. Anything else you do will be equivalent to sorting (there is no "formula")
Are you using T-SQL? T-SQL RANK() may pull what you want.

how to repeat the direction in listview control

i using datalist control where i am displaying images under it. that is( 6 columns * 5 rows)
for thati have property repeat direction is "horiztonal" .
like the above design i need perform in listview Control (i.e )
display like this( here 1,2 are data after 6 data is displayed 7th data start from second row)
1 2 3 4 5 6
7 8 10 11 12 13
any help would be great thank you
A ListView is better suited for this.
EDIT
You can insert basic HTML in the ItemTemplate and use the binding syntax described here:
https://web.archive.org/web/20211020150712/https://www.4guysfromrolla.com/articles/010208-1.aspx
Try RepeatColumns to specify the item count in a row like this :
DataList1.RepeatColumns = 6;
DataList1.RepeatDirection = RepeatDirection.Horizontal;

Resources