-
Notifications
You must be signed in to change notification settings - Fork 14
No bubbles displayed if only start date exist. #92
Conversation
@SergeyBondarenko please rebase. This PR has changes about the multivalued PR that shouldn't be here. |
@SergeyBondarenko you can propose a PR to the vis lib if you want ;o) |
cdf5613
to
212b800
Compare
@scampi Yes, I can, I wrote it above. |
good idea. BTW this was @nreese feature ;o) |
I got "play with CSS" suggestion from one of the vis contributors. almende/vis#2508 (comment) |
In order to be able to change color add custom styled dot instead of vis-dot. Refactor code.
rebased on master |
style = `border-style: none; background-color: #fff; color: ${groupColor}; border-color: ${groupColor}`; | ||
const divregex = /(<div.*>)(.*)(<\/div>)/g; | ||
const contentDivParts = divregex.exec(content); | ||
const pointDot = '<div style="position:relative;padding:0;border-width:4px;border-style:solid;' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create a class in the less file with this style.
const contentDivParts = divregex.exec(content); | ||
const pointDot = '<div style="position:relative;padding:0;border-width:4px;border-style:solid;' + | ||
'border-radius:4px;float:left;margin-top:6px;margin-right:4px;border-color:' + groupColor + '"></div>'; | ||
const labelDiv = '<div style="margin-left: 15px">' + contentDivParts[2] + '</div>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
// force vis box look like vis point | ||
style = `border-style: none; background-color: #fff; color: ${groupColor}; border-color: ${groupColor}`; | ||
const divregex = /(<div.*>)(.*)(<\/div>)/g; | ||
const contentDivParts = divregex.exec(content); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, you can have an angular template where you would use ng-class
to set the appropriate class. Then you would compile that template to get the final HTML. See tooltip of the tilemap vis in kibana for some example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about line 250? But this variable is assigned as property to the e
object below to form the visualization items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, ok, you are talking about stuff below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes ;o) I put the comment here because this way you wouldn't have any HTML code in that file and so no need for the regexp
let content = $compile(itemTemplate)($itemscope)[0].innerHTML; | ||
console.log('INNER HTML:'); | ||
|
||
const content = timelineHelper.createItemTemplate(i, itemDict); | ||
console.log(content); | ||
|
||
let style = `background-color: ${groupColor}; color: #fff;`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szydan Seems I can't deprecate this style
variable because I need to change the groupColor
for every group.
endFieldValue: endFieldValue | ||
}; | ||
|
||
const content = timelineHelper.createItemTemplate(i, itemDict); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you using "i" if not please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I do it in the template building method. But I'll look, maybe I can refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got rid of the i
variable in the template method.
@@ -1,3 +1,4 @@ | |||
/* global angular */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't needed anymore, I'll delete it.
@@ -7,6 +7,16 @@ define(function (require) { | |||
function TimelineHelper() { | |||
} | |||
|
|||
TimelineHelper.prototype.createItemTemplate = function (itemDict) { | |||
return '<div title="index: ' + itemDict.indexId + ', startField: ' + itemDict.startField + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you try using lodash template ? https://lodash.com/docs/3.10.1#template
maybe it will improve readability
jenkins test it |
(!itemDict.endFieldValue || itemDict.startValue === itemDict.endFieldValue | ||
? '<div class="kibi-tl-label-item">' + itemDict.labelValue + '</div>' : itemDict.labelValue) + | ||
(itemDict.useHighlight ? '<p class="tiny-txt">' + itemDict.highlight + '</p>' : '') + '</div>'; | ||
let endfield = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scampi how do you find my readability code refactoring?
Issue #89
I added the dots by manually manipulating HTML and style. Now it looks exactly like it is in our docs:
I haven't found a way to do it purely with vis.js. The library doesn't display relations to the X axis when
e.type: 'point'
is used as an event property. In short words, I got the visualization similar to this http://visjs.org/examples/timeline/items/pointItems.htmlOther examples:
http://visjs.org/examples/timeline/items/backgroundAreasWithGroups.html
http://visjs.org/examples/timeline/dataHandling/dataSerialization.html
http://visjs.org/examples/timeline/dataHandling/loadExternalData.html
http://visjs.org/examples/timeline/editing/editingItems.html
Seems like
e.type: point
is designed to not place relations to the X axis.I can go and fix it in the library.