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

Added ability to set smooth parameter per series #91

Merged
merged 2 commits into from
Oct 20, 2012
Merged

Added ability to set smooth parameter per series #91

merged 2 commits into from
Oct 20, 2012

Conversation

tiraeth
Copy link
Contributor

@tiraeth tiraeth commented Oct 15, 2012

This feature gives user an option to draw a smooth path only in chosen series. It is backward compatible and by default draws all paths smooth.

In examples/weeks.html we can force Morris to draw smoothly only one series by calling it:

// (...)
Morris.Line({
  element: 'graph',
  data: week_data,
  xkey: 'period',
  ykeys: ['licensed', 'sorned'],
  labels: ['Licensed', 'SORN'],
  smooth: ['licensed']
});

The smooth option key is now type of boolean|array. If you want to use the feature, series for which ykeys are included in the array will get their path drawn smoothly.

Note: Not sure if I should include compiled versions (using grunt) but did it anyway. If you'd like me not include them, just tell.

@oesmith
Copy link
Contributor

oesmith commented Oct 19, 2012

What's the use case for smoothing some paths and not others?

I'm becoming increasingly concerned that the list of options for Morris.Line is becoming too long, and I'd like to avoid adding any new options unless it's absolutely necessary.

@tiraeth
Copy link
Contributor Author

tiraeth commented Oct 19, 2012

When you want to show a trend. For example, you have a line graph that shows you the trend of your site's visits for example. And this is a polyline. You want to compare this value to the whole segment (e.g. other sites within the same network). You can show the segment's average value as a smooth path.

This is one use case for it.

As another enhancement I would recommend adding styling to the chart so I can modify the font of categories/y-labels and other things. It would be nice to have a map that would be extended with default values, just like Highcharts allows me. Right now the chart itself is not easily customizable. But these are things I may be working on later due to things I am going to use Morris.js with.

@oesmith
Copy link
Contributor

oesmith commented Oct 19, 2012

OK cool, I'll try to get this code reviewed this over the weekend.

Thanks for the contribs!

@oesmith oesmith merged commit b8674f3 into morrisjs:master Oct 20, 2012
@oesmith
Copy link
Contributor

oesmith commented Oct 20, 2012

All merged!

Note I did make the implementation a little more concise - see my changes.

@tiraeth
Copy link
Contributor Author

tiraeth commented Oct 21, 2012

Cool, thanks! I am thinking about one more (or two) addons/fixes. The grid. I think that it would be useful to have no horizontal lines (right now, as far as I remember, you can't have it configured) or have vertical lines (grid) in chosen configuration (interval or per category).

Some can find useful to draw grid behind the graph. If we could achieve it, it would be awesome.

@oesmith
Copy link
Contributor

oesmith commented Oct 21, 2012

For the bar and area chart features I'll be moving the grid rendering code
out into a separate class (or possibly a base class), so there should be
plenty of scope to add new features in the grid.

Sent from my iPad

On 21 Oct 2012, at 11:25, Marcin Chwedziak notifications@github.com wrote:

Cool, thanks! I am thinking about one more (or two) addons/fixes. The grid.
I think that it would be useful to have no horizontal lines (right now, as
far as I remember, you can't have it configured) or have vertical lines
(grid) in chosen configuration (interval or per category).

Some can find useful to draw grid behind the graph. If we could achieve it,
it would be awesome.


Reply to this email directly or view it on
GitHubhttps://github.com/oesmith/morris.js/pull/91#issuecomment-9641393.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants