Problem/Motivation

This might be a feature request instead of a bug report. What I'm wanting is to create a time-series plot with connected points. It's cumulative, so if there are multiple points with the same x-value, they should all be plotted (with different y-values). I'm using your View Cumulative Field module to get the y-values :)

If this is a feature request, it's that I'd like to be able to connect the points in a scatterplot.

Looks like for Plotly, though, line plots are just connected scatterplots, so a line plot should do what I want. And it mostly does (see below plot).

line plot

Side note: this behavior is different than a few of the other plotting backends I tried with Charts - most of them treated the dates as a category and not a true x-value. I personally prefer Charts Plotly's behavior, but I may be biased because it's what I need...

The problem is that identical x-values (dates) are getting merged together at some level (in Charts?). This results in x and y series of different lengths (observed via the Charts debug output), and not all of the data gets plotted/some data gets plotted incorrectly. For my particular case, this problem gets more pronounced if I use a less granular date representation for the x-values. Here's the same data but using the "HTML month" formatter instead of "HTML datetime":

line plot

I'm not doing any aggregation in the View.

Anyway, short version: I think that if Plotly's line plots behave this way (which I like!), then Charts should not be attempting to group the data in a line plot (if that's what's going on).

Steps to reproduce

Create a line plot with a data series that has points with identical x-values. View the Charts debug output to see x- and y-vectors of different lengths.

Proposed resolution

Don't merge duplicate x-values in line plots.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mwymore created an issue. See original summary.

andileco’s picture

This is interesting. A few requests:

Would you be able to create a CSV of dummy data that could be used for testing?
Could you replicate your view with the Views CSV Source module?
Could you then share your View configuration?

If not, could you just share your View configuration? In particular, I'm interested to see if you're using the "Group by" option on your date field.

mwymore’s picture

StatusFileSize
new47 bytes
new6.22 KB
new152.8 KB

I uploaded a dummy_dataset.csv and a view configuration and a screenshot of my Views UI. Let me know if I can provide anything else. Thanks.

andileco’s picture

Status: Active » Needs review
StatusFileSize
new7.91 KB

Please import this modification of the view and test with the MR. Would this work for you?

mwymore’s picture

Yes, this is great! It also works with my original dataset. Thank you.

andileco’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.