Gantt: Configurable format for dates on x-axis

Flowchart: Default styles for links as discussed in issue #31
This commit is contained in:
knsv
2015-02-28 23:50:23 +01:00
parent 8598a7d712
commit 3c5a19e5a7
15 changed files with 674 additions and 429 deletions

View File

@@ -108,6 +108,15 @@ exports.addVertices = function (vert, g) {
exports.addEdges = function (edges, g) {
var cnt=0;
var aHead;
var defaultStyle;
if(typeof edges.defaultStyle !== 'undefined'){
defaultStyle = edges.defaultStyle.toString().replace(/,/g , ';');
console.log('edges def: '+defaultStyle);
//console.log('edges def:'+defaultStyle.replace(',' , ';','g'));
}
edges.forEach(function (edge) {
cnt++;
@@ -122,7 +131,6 @@ exports.addEdges = function (edges, g) {
var style = '';
if(typeof edge.style !== 'undefined'){
edge.style.forEach(function(s){
style = style + s +';';
@@ -132,6 +140,9 @@ exports.addEdges = function (edges, g) {
switch(edge.stroke){
case 'normal':
style = 'stroke: #333; stroke-width: 1.5px;fill:none';
if(typeof defaultStyle !== 'undefined'){
style = defaultStyle;
}
break;
case 'dotted':
style = 'stroke: #333; fill:none;stroke-width:2px;stroke-dasharray:3;';
@@ -140,8 +151,6 @@ exports.addEdges = function (edges, g) {
style = 'stroke: #333; stroke-width: 3.5px;fill:none';
break;
}
}
// Add the edge to the graph

View File

@@ -75,7 +75,12 @@ exports.addLink = function (start, end, type, linktext) {
*/
exports.updateLink = function (pos, style) {
var position = pos.substr(1);
edges[pos].style = style;
if(pos === 'default'){
edges.defaultStyle = style;
}else{
edges[pos].style = style;
}
};
exports.addClass = function (id, style) {

View File

@@ -9,6 +9,7 @@
%%
"style" return 'STYLE';
"default" return 'DEFAULT';
"linkStyle" return 'LINKSTYLE';
"classDef" return 'CLASSDEF';
"class" return 'CLASS';
@@ -384,8 +385,10 @@ textNoTags: textNoTagsToken
;
classDefStatement:CLASSDEF SPACE alphaNum SPACE stylesOpt
classDefStatement:CLASSDEF SPACE DEFAULT SPACE stylesOpt
{$$ = $1;yy.addClass($3,$5);}
| CLASSDEF SPACE alphaNum SPACE stylesOpt
{$$ = $1;yy.addClass($3,$5);}
;
classStatement:CLASS SPACE alphaNum SPACE alphaNum
@@ -402,8 +405,10 @@ styleStatement:STYLE SPACE alphaNum SPACE stylesOpt
{$$ = $1;yy.updateLink($3,$5);}
;
linkStyleStatement:
LINKSTYLE SPACE NUM SPACE stylesOpt
linkStyleStatement
: LINKSTYLE SPACE DEFAULT SPACE stylesOpt
{$$ = $1;yy.updateLink($3,$5);}
| LINKSTYLE SPACE NUM SPACE stylesOpt
{$$ = $1;yy.updateLink($3,$5);}
;
@@ -426,7 +431,7 @@ styleComponent: ALPHA | COLON | MINUS | NUM | UNIT | SPACE | HEX | BRKT | DOT |
commentToken : textToken | graphCodeTokens ;
textToken : textNoTagsToken | TAGSTART | TAGEND | '==' | '--' | PCT ;
textToken : textNoTagsToken | TAGSTART | TAGEND | '==' | '--' | PCT | DEFAULT;
textNoTagsToken: alphaNumToken | SPACE | MINUS | keywords ;

File diff suppressed because one or more lines are too long