Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goal Line with second-Y-Axis #1

Closed
holema opened this issue Feb 1, 2018 · 7 comments
Closed

goal Line with second-Y-Axis #1

holema opened this issue Feb 1, 2018 · 7 comments
Assignees

Comments

@holema
Copy link

holema commented Feb 1, 2018

Hello,
first I realy want to say thank for that great extension from the original Morris.
I use this Graph in an webapp and want to add two Goal-Lines in one Graph. one goal-Line should be attached to the right y-Axis and the second to the left y-axis. but it attaches both to the right y-axis. Is there a workaround for this issue?

best regards.

@pierresh
Copy link
Owner

pierresh commented Feb 1, 2018

Hello,

Thanks a lot for your message. Actually this function is not available for the moment but it should be easy to add, I will try to develop it tonight.

@pierresh pierresh assigned pierresh and unassigned pierresh Feb 1, 2018
@holema
Copy link
Author

holema commented Feb 1, 2018

Hello,
thanks a lot four your fast reply and your help. That feature realy would be great for me.

Best regards

pierresh pushed a commit that referenced this issue Feb 1, 2018
@pierresh
Copy link
Owner

pierresh commented Feb 1, 2018

Hello,

You can check the version in master, you can set the goals for the right Y axis in the options goals2.

@holema
Copy link
Author

holema commented Feb 1, 2018

Hello Pierresh,
great. This feature is so much worth.
The color from the second-goalLine is not adjustable? up to now? if not, I can try to implement it.

@holema
Copy link
Author

holema commented Feb 1, 2018

I make the second GoalLines-Color changeable as well.
If there is no color given in the options, the coresponding line color is choosen.
Should I send you the source?
Best regards.

@pierresh
Copy link
Owner

pierresh commented Feb 2, 2018

Hello,

Thanks for your feedback, I just added the capabilities to set colors (goalLineColors2) and width (goalStrokeWidth2) of goals2.

@holema
Copy link
Author

holema commented Feb 2, 2018

Hello,

Thanks a lot for this feature Update.
I did it this way, that as default color of the goalLine, the corresponding line-Color is choosen, because I want to make the chart as an universal Twig template to draw automatically as much lines, as I want, only set by the size of the parameter array.

Grid.prototype.gridDefaults = { dateFormat: null, axes: true, freePosition: false, grid: true, gridLineColor: '#aaa', gridStrokeWidth: 0.5, gridTextColor: '#888', gridTextSize: 12, gridTextFamily: 'sans-serif', gridTextWeight: 'normal', hideHover: false, yLabelFormat: null, yLabelAlign: 'right', xLabelAngle: 0, numLines: 5, padding: 25, parseTime: true, postUnits: '', postUnits2: '', preUnits: '', preUnits2: '', ymax: 'auto', ymin: 'auto 0', y2max: 'auto', y2min: 'auto 0', goals: [], goals2: [], goalStrokeWidth: 1.0, goalLineColors: [], goalLineColors2: [], events: [], eventStrokeWidth: 1.0, eventLineColors: ['#005a04', '#ccffbb', '#3a5f0b', '#005502'], rangeSelect: null, rangeSelectColor: '#eef', resize: false, dataLabels: true, dataLabelsPosition: 'outside', dataLabelsFamily: 'sans-serif', dataLabelsSize: 12, dataLabelsWeight: 'normal', dataLabelsColor: '#000', animate: true, nbYkeys2: 0, smooth: true };

Grid.prototype.drawGoal = function(goal, color) { var path, y; y = Math.floor(this.transY(goal)) + 0.5; if (!this.options.horizontal) { path = "M" + this.xStart + "," + y + "H" + this.xEnd; } else { path = "M" + y + "," + this.xStart + "V" + this.xEnd; } return this.raphael.path(path).attr('stroke', color).attr('stroke-width', this.options.goalStrokeWidth); }; Grid.prototype.drawGoal2 = function(goal, color) { var path, y; y = Math.floor(this.transY2(goal)) + 0.5; if (!this.options.horizontal) { path = "M" + this.xStart + "," + y + "H" + this.xEnd; } else { path = "M" + y + "," + this.xStart + "V" + this.xEnd; } return this.raphael.path(path).attr('stroke', color).attr('stroke-width', this.options.goalStrokeWidth); };

Best regards and thanks a lot for your fast help.
Emanuel

@pierresh pierresh closed this as completed Feb 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants