Kendo UI waterfall custom data - kendo-ui

I 'd created a waterfall with similar to waterfall chart given in the demo section. I would like to add a Running time at the end of the chart with value starting from 0.
Please find here the dojo https://dojo.telerik.com/EgABaJiR/2
Required output is like in the image below

Not quite sure about your question. I don't understand what you mean by "I would like to add a net time at the end of the chart with value starting from 0." But based on your image, I'm guessing you want the column upside down and hitting the 0 axis. On that note, you can try these as the last value in your cashFlowData:
{ "name": "Running Time", "summary": "total" }
{ "name": "Running Time", "druation": -12.5 }
{ "name": "Running Time", "summary": "runningTotal" }
All 3 will hit the 0 axis.
Thank you for your quick answer. But my question is to add the running time at the end, i mean after net time. and it has its own value (15hrs according to my demo) and it should start from 0 axis. Moreover, Summary: total and runningtotal will actually sum from previous column(s). I dont want to sum it from the previous columns
Since this is a waterfall chart then you need to make the last column to zero in order for the 15hrs to start at the zero axis. So a trick would be to make the last values of cashFlowData as follows:
{
"name": "Net Time",
"summary": "total"
},
{
"name": "Running Time",
"druation": -12.5,
},
{
"name": "from zero",
"druation": 15
}
With the above, you'll have 15hrs starting from zero. But I'm guessing you don't want -12.5 rendered. So I'd probably implement something in series.visual saying if name equals Running Time then do not draw. You get the idea?

Related

Search score of identical documents changes when nested integer attribute is modified

We stumbled upon this issue today and cannot really understand what is happening.
Suppose we have a really simple index with just two documents inside that have the same contents.
// document 1
{
"question": "text of the question",
// nested part
"answers": [
{
"text": "text of first answer",
"clickscore": 0,
},
]
//
}
// document 2
{
"question": "text of the question",
// nested part
"answers": [
{
"text": "text of first answer",
"clickscore": 0,
},
]
//
}
question and answers.text are Text fields with the same analyzer defined on them. answers is a list with either 1 or many answers inside. clickscore is an Integer field that we will use in the future to boost the relevance of some documents. When we do a search we always look for matches in question and answers.text.
Now the weird part.
document 1 and document 2 have EXACTLY the same content, thus a search on the cluster with text contained in both question and answers.text (for example "text") returns hits with exactly the same score: makes sense.
However, if we update the clickscore of one of the two documents by setting e.g. the document 2 clickscore == 1 and we repeat EXACTLY the same search then the score of the documents are NOT the same.
How is this possible? clickscore is just an integer attribute and it should not affect the score of the search, especially since we're only looking for matches in the Text fields...
Apparently the problem is related to the fact that the shard statistics are not updated on time, and this causes the discrepancy.
If anyone arrives here on this question the only way to fix this is to manually perform a flush, so Index('...').flush() and the scores then are the same again.

Binning Data With Two Timestamps

I'm posting because I have found no content surrounding this topic.
My goal is essentially to produce a time-binned graph that plots some aggregated value. For Example. Usually this would be a doddle, since there is a single timestamp for each value, making it relatively straight forward to bin.
However, my problem lies in having two timestamps for each value - a start and an end. Similar to a gantt chart, here is an example of my plotted data. I essentially want to bin the values (average) for when the timelines exist within said bin (bin boundaries could be where a new/old task starts/ends). Likeso.
I'm looking for a basic example or an answer to whether this is even supported, in Vega-Lite. My current working example would yield no benefit to this discussion.
I see that you found a Vega solution, but I think in Vega-Lite what you were looking for was something like the following. You put the start field in "x" and the end field in x2, add bin and type to x and all should work.
"encoding": {
"x": {
"field": "start_time",
"bin": { "binned": true },
"type": "temporal",
"title": "Time"
},
"x2": {
"field": "end_time"
}
}
I lost my old account, but I was the person who posted this. Here is my solution to my question. The value I am aggregating here is the sum of times the timelines for each datapoint is contained within each bin.
First you want to use a join aggregate to get the max and min times your data extend to. You could also hardcode this.
{
type: joinaggregate
fields: [
startTime
endTime
]
ops: [
min
max
]
as: [
min
max
]
}
You want to find a step for your bins, you can hard code this later or use a formula and write this into a new field.
You want to create two new fields in your data that is a sequence between the max and min, and the other the same sequence offset by your step.
{
type: formula
expr: sequence(datum.min, datum.max, datum.step)
as: startBin
}
{
type: formula
expr: sequence(datum.min + datum.step, datum.max + datum.step, datum.step)
as: endBin
}
The new fields will be arrays. So if we go ahead and use a flatten transform we will get a row for each data value in each bin.
{
type: flatten
fields: [
startBin
endBin
]
}
You then want to calculate the total time your data spans across each specific bin. In order to do this you will need to round up the start time to the bin start and round down the end time to the bin end. Then taking the difference between the start and end times.
{
type: formula
expr: if(datum.startTime<datum.startBin, datum.startBin, if(datum.startTime>datum.endBin, datum.endBin, datum.startTime))
as: startBinTime
}
{
type: formula
expr: if(datum.endTime<datum.startBin, datum.startBin, if(datum.endTime>datum.endBin, datum.endBin, datum.endTime))
as: endBinTime
}
{
type: formula
expr: datum.endBinTime - datum.startBinTime
as: timeInBin
}
Finally, you just need to aggregate the data by the bins and sum up these times. Then your data is ready to be plotted.
{
type: aggregate
groupby: [
startBin
endBin
]
fields: [
timeInBin
]
ops: [
sum
]
as: [
timeInBin
]
}
Although this solution is long, it is relatively easily to implement in the transform section of your data. From my experience this runs fast and just displays how versatile Vega can be. Freedom to visualisations!

Dynamic Achievement System algorithm / design

I'm developing this Achievement System and it must have a CRUD, that admins access to create new achievements and it's rules. I need some help with the design & algorithm of this so it can easily evolve with new rules as admins ask.
Rules sample
Medal one: must complete 5 any courses with a score of at least 90
Medal two: must complete two specific courses with a score of at least 85
Medal three: must be top 5 in general ranking at least once
Medal four: must have more than 5000 points
I'll basically store that as metadata in a relational database, probably with these columns below:
action
action quantity
course quantity
score
id course
ranking
position
points
I want to know if there is any known algorithm / design to this kind of problem? Or perhaps I should store them differently to make it easier? Don't know, I want suggestions.
Your doubts may be right. In my opinion, a database is the wrong way to organize this data. Every new kind of achievement you want to create would add extra columns to your database, and most achievements wouldn't use most of the columns. A more flexible data structure, one that doesn't expect for every entry to use all of the possible achievement criteria at once by default, would probably be more useful. Most languages support JSON, so I suggest you use that. The structure could be something like this:
[
{
"name": "Medal One",
"requirements": {
"coursesCompleted": 5,
"scoreMin": 90
}
},
{
"name": "Medal Two",
"requirements": {
"specificCoursesCompleted": [
"Course 1",
"Course 2"
],
"scoreMin": 85
}
},
{
"name": "Medal Three",
"requirements": {
"generalRankingMin": 5
}
},
{
"name": "Medal Four",
"requirements": {
"scoreMin": 5000
}
}
]
You can see here how the criteria types are sometimes reused, but they can be omitted when not needed and new ones can be added to a few achievements without bloating the rest of the dataset as well.
PS: I made the criteria names very verbose for demonstration purposes; shortening them or not in actual use is up to preference.

Grouping non null fields together in Kibana

Given the following three User entries in an ElasticSearch index:
"user": [
{
"userId": "100",
"hobby": "chess"
}
"user": [
{
"userId": "200",
"hobby": "music"
}
"user": [
{
"userId": "300",
"hobby": ""
}
I want to create a vertical bar chart to compare the number of users who have a hobby as opposed to those who do not. Individual hobbies should not be shown separately, but grouped together.
If split along the Y axis, one block would take up two thirds of the height (the two users with hobbies) and one block one third of the height (the one user with no hobbies).
How could one achieve this grouping in Kibana?
Thanks
You'll need to choose Split Bars and then Filters aggregation. Once you have that selected you should see Query 1 with * in it. Change the * to hobby:*. Next hit Add Filter and put in NOT hobby:*
The filters aggregation lets you bucket things pretty much any way you can search for things.

How to create value over time chart with Kibana 3?

I use logstash to store log files containing the speed of vehicles over time.
In Kibana 3, how can I generate a panel which displays a value over time, i.e. the x axis displays the time and the y axis the related value, e.g. vehicle speed.
Most panels I found count the occurrence of events in a given time span and display it on the y axis. My goal however is to directly print a value from the json log entry (wheelSpeed_m_s), which looks as follows:
{
"_index": "logstash-2013.05.07",
"_type": "vehicle_odometry",
"_id": "Q3b58Pi7RUKuPon0s_ihlA",
"_score": null,
"_source": {
"message": " ",
"wheelSpeed_m_s": 0.91,
"#timestamp": "2013-05-07T17:50:04.099+02:00",
"angularVelocity_rad_s": 0,
"type": "vehicle_odometry",
"#version": "1",
"ts_ms": 1367934604099
},
}
Any help is highly appreciated.
In the histogram panel, click the "Configure" (gear) icon, then select the "Panel" tab.
On that tab, you can select the "Chart value". This defaults to count, but can be any of the basic math set functions (mean, max, min, total). Select the function, and you'll be asked to enter the field to which the function should be applied:
OP: please don't accept this answer (rutter deserves the points for getting you straight). I leave the info here to complete the question so it's not marked as 'unanswered'.

Resources