vis.js Chronological set of items in Timeline View - vis.js-timeline

Instead of having actual time mapping with the items in Timeline View, is there a way by which we can have items arranged chronologically in sequence of timestamps. This feature will help me eliminate gaps between items with greater timestamp difference.
For Example
E1: 1
E2: 6
E3: 9
Current Timeline View would represent it as
[1 - E1] 2 3 4 5 [6 - E2] 7 8 [9 - E3]
What I want is chronological order
[1 - E1] [2 - E2] [3 - E3]

you can achieve what you are asking for by using the hiddenDates option of the timeline
{
"option": "hiddenDates",
"type": "object|Array",
"default": "none",
"description": "This option allows you to hide specific timespans from the time axis. The dates can be supplied as an object: {start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00', [repeat:'daily']} or as an Array of these objects. The repeat argument is optional. The possible values are (case-sensitive): daily, weekly, monthly, yearly. To hide a weekend, pick any Saturday as start and the following Monday as end and set repeat to weekly."
}
In your case you can specify hiddenDates as
var options = {hiddenDates: [{start: '2', end:'6'},{start:'7',end: '9'}]}
If this doesn't answer your question, I can provide a jsfiddle with a solution.
Best regards,
Betim.

Related

DAX Syntax - if versus switch

Need help with the correct syntax. I need to determine based on 3 columns (Year, Years of Service, Terminate) if the years of service fall between the following criteria or the Terminate column has a date.
IF(["#YearsofService"]=>2,"2+ Years" else "Less than 2 Years") else Terminate(has a date) is not null. This will be for an new column displaying the criteria text.
also tried Switch function.
=SWITCH(TRUE()
[#"#YearsofService"] >=2,"2 + Years" & [#"#YearsofService"] <2, "Less Than 2 Years",
isblank([Term Date]), "Termed"
)
also tried:
IF(ISBLANK([Term Date])=false, "Termed",IF([#"#YearsofService"] >=2,"2 + Years","Less Than 2 Years"))
but does not like the If portion of statement
I think SWITCH TRUE would be the best solution for this sort of multi-test requirement. The sequence of tests after the TRUE is critical - DAX will stop evaluating after the first TRUE result is struck. So here's my attempt:
=SWITCH(TRUE()
, NOT(ISBLANK([Term Date])), "Termed"
, [#YearsofService] >=2,"2 + Years"
, [#YearsofService] <2, "Less Than 2 Years"
)
In your example you are only using two of the mentioned columns (Years of Service and Terminate). I guess the statement should look like this:
Result = IF(ISBLANK([Term Date]);IF([#"#YearsofService"]<2;"Less than 2 years";"More than 2 years");"Termed")

How to detect trending items with popularity count?

I made a search app with elasticsearch.
Items have name and follower count. I use follower count to boost elasticsearch result.
Ex: Let's say i have two item. item_1 = [name = "abc def", follower = 1000] and item_2 = [name = "abc", follower = 10].
So, when user search for "abc", even though item_2 is exact match I bring item_1 as most likely result.
This works just fine for me.
But I want to add new feature to this.
I want to be able to detect items that getting popular and boost their score.
So, I think if I store follower count daily for a week or a month.
Like;
ItemNo Day1 Day2 Day3 Day4 ...
1 1000 1030 1040 1050 ...
2 50 100 200 400 ...
3 1M 1.001M 1.002m 1.003M ...
4 1.1M 1.1M 1.1M 1.1M ...
So, if daily follower count increase like this for item 1, 2, 3 and 4.
Then, I should be able to detect increase of follower count for item 2 and boost it over item 1.
Because, even though item 1 has more follower, item 2 is getting more follower every day.
But, item 3 and should not be boosted over item 4 because percentage of increase on item 3 is very small.
Bottom line, i want to be able to detect increasing popularity but it should be based on increase percentage.
So, do you have any suggestion to do this. or can you refer any paper that help me to solve this problem?

How to create x-axis range groups with Crossfilter and dc.js?

Here is a fiddle to help show what I'd like to do:
http://jsfiddle.net/m4x7o5of/
I have a set of records, each with a float value. For example:
var records = [{name: 'record1', value: 1.34563}, ..., {name: 'record5000', value: 0.62974}];
I'd like to create a barchart in dc.js that plots the records on the x-axis in range buckets, e.g x-number of records with value between 0 and .5, y-number of records between .5 and 1, z-number of records between 1 and 1.5, and so on.
I'm using an ordinal scale so that I can divide the set of records into 5ths, but I can't figure out how to get the records grouped together in the ranges like I described. In the linked fiddle, only the records with a value that matches the plotted ordinals will get displayed right now.
Is it even possible to group the records like this? Any help would be appreciated.
dimension.group takes a function that you can use to derive the group key. So dimension.group(function(d) { return Math.floor(d); }); will give you group keys of 0, 1, 2, 3, 4, 5, 6, 7, and 8 for your data set. You'll just need to construct a function that returns the values you want based on the values in your data set. Is that what you're looking to do?

Qlikview, how to create an expression which does not change with listbox selection?

Example, I have table below..
Week, Quantity
1, 10
1, 15
1, 10
2, 20
2, 30
3, 10
3, 50
I also have a list box for 'Week' which is current selected on week 2.
Now, I want to create text object which shows the value of sum of quantity of week 1 (ie. 35), which will always show that result even when the list box is selected on week 2. How can I achieve this?
Currently I managed to do an expression which sums week 1 but as soon as I select week 2 it shows 0 ....
Enter the following to your textfield:
= 'Sum week 1 : ' & sum({$<Week={'1'}>}Quantity)
Use the '&' to concat values. And use the set analysis (Page 799 of the QlikView Reference Manual) to select the reqired values.
sum({$<Week={'1'}>}Quantity)
Read this like: Sum the values of 'Quantity' Where 'Week' is 1.
Replace the '$' with '1' and the expression will ignore current selection
e.g.
sum({1<Week={'1'}>}Quantity)
do this:
sum({<Week={'1'}>}Quantity)
That is basically telling Qlikview regardless of what is selected in Qlikview, that expression will always calculate as if Week 1 is selected.

Pandas Panel for share portfolio

I have a pandas panel of investment pricing data to which I want to add two new minor axis columns (portfolio holding and benchmark holding).
The initial panel is:
<class 'pandas.core.panel.Panel'>
Dimensions: 4 (items) x 463 (major) x 8 (minor)
Items: ListedEquity:BHP Billiton:BHP.AX to SavingsAccount:ING Australia Savings Maximiser
Major axis: 2010-01-04 00:00:00 to 2011-10-31 00:00:00
Minor axis: content_type to xrate
which conceptually looks like:
Investment 1 Investment 2
c1 c2 c3... c1 c2 c3...
Date 1
Date 2
...
Is it possible create a matching panel that only has these columns and then somehow merge the two?
Thoughts on possible alternative ways of achieving this?
The documentation on the Panel data structure is pretty bare.
EDIT:
I created the 2nd panel and tried p1.join(p2) but this generates a columns overlap error.
Here's the 2nd panel I would like to append:
<class 'pandas.core.panel.Panel'>
Dimensions: 4 (items) x 463 (major) x 2 (minor)
Items: ListedEquity:BHP Billiton:BHP.AX to SavingsAccount:Comsec Cash Management Account
Major axis: 2010-01-04 00:00:00 to 2011-10-31 00:00:00
Minor axis: benchmark to portfolio
Sorry I missed this question some time ago. Could you have a look at the new concat function in pandas 0.7.0 and see if it meets your needs:
http://pandas.pydata.org/pandas-docs/stable/merging.html#concatenating-objects
I recently spent a great deal of time on the join and concatenation methods.

Resources