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

feat: add issue and pr related interaction #524

Merged

Conversation

andyhuang18
Copy link
Collaborator

@andyhuang18 andyhuang18 commented Nov 16, 2022

Brief Information

This pull request is in the type of (more info about types):

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • test

Related issues (all available keywords):

Details

Checklist

Others

@tyn1998
Copy link
Member

tyn1998 commented Nov 17, 2022

Hi @andyhuang18, I think I have found the reason why the chart does not respond to click event, finally!

Click events of line series chart can only be fired when we click on points rather lines:

image

However the points at the moment are set to none. If we set the symbol option to circle like above, we can click it.

@andyhuang18
Copy link
Collaborator Author

Hi @tyn1998 ,Thanks for helping~ What a interesting difference between bar chart and line chart! Now that I am aware of this reason, I will continue working :)

@tyn1998
Copy link
Member

tyn1998 commented Nov 17, 2022

Enabling points will make the chart ugly in my view. Another way is to make the tooltip enterable and add code for interaction in the tooltip. However, it seems hard for users to enter the tooltip (they may try several times before succeeds entering it), like the video shows in below:

2022-11-17.13.38.03.mov

Hi @frank-zsy, what do you think? Which way do you prefer, or just close the issue?

@andyhuang18
Copy link
Collaborator Author

Enabling points will make the chart ugly in my view. Another way is to make the tooltip enterable and add code for interaction in the tooltip. However, it seems hard for users to enter the tooltip (they may try several times before succeeds entering it), like the video shows in below:

2022-11-17.13.38.03.mov
Hi @frank-zsy, what do you think? Which way do you prefer, or just close the issue?

Looks like it is hard for mouse to catch up the tooltip.

@frank-zsy
Copy link
Contributor

Click tooltip is not a good idea. So there is no event trigger when clicking on the line without enabling the points?

@tyn1998
Copy link
Member

tyn1998 commented Nov 17, 2022

Yes. I think that is because a line does not represent a time point.

@andyhuang18
Copy link
Collaborator Author

I find that there is a triggerLineEvent
微信截图_20221117182445

@tyn1998
Copy link
Member

tyn1998 commented Nov 17, 2022

That is so great!

https://echarts.apache.org/zh/option.html#series-line.triggerLineEvent

@andyhuang18
Copy link
Collaborator Author

I'm wondering why the click function can't receive parameters when I click the line, however the tooltipFormatter can receive parameters.

In tooltipFormatter
微信截图_20221117211031
So tooltip can display year-month information.

@tyn1998
Copy link
Member

tyn1998 commented Nov 17, 2022

Hi @andyhuang18, could you push a commit to this branch so I can have a look into the codebase.

@andyhuang18
Copy link
Collaborator Author

andyhuang18 commented Nov 17, 2022

These are parameters of onclick function. There isn't any data.
微信截图_20221117213538

When I click the point, the function can receive the correct parameters. As the screenshot below
微信截图_20221117214102

@andyhuang18
Copy link
Collaborator Author

Hi @andyhuang18, could you push a commit to this branch so I can have a look into the codebase.

Sure~

@andyhuang18
Copy link
Collaborator Author

I can interact with the point of issue chart right now.

@tyn1998
Copy link
Member

tyn1998 commented Nov 17, 2022

The click event on line seems provide no detailed data, as you mentioned. However, the effect of your code is good. Though symbol is set, but with symbolSize set to a small value, it will only be visible when you hovering on it, which is really wanted!

2022-11-17.22.18.41.mov

You can apply this method to another chart :)

@andyhuang18
Copy link
Collaborator Author

The click event on line seems provide no detailed data, as you mentioned. However, the effect of your code is good. Though symbol is set, but with symbolSize set to a small value, it will only be visible when you hovering on it, which is really wanted!

2022-11-17.22.18.41.mov
You can apply this method to another chart :)

Copy that~ :)

@andyhuang18
Copy link
Collaborator Author

andyhuang18 commented Nov 17, 2022

Now we can interact with both point and line~ Though my solution maybe is not the perfect one...

@tyn1998
Copy link
Member

tyn1998 commented Nov 18, 2022

@andyhuang18, you are sooooo smart! Nice workaround!

The solution is very good while there is still room for functional improvments:

  • to allow user to click open line to visit Issues/PR list filtered by "created:xxxx-xx"
  • to allow user to click close/merge line to visit Issues/PR list filtered by "closed:xxxx-xx"/"merged:xxxx-xx"
  • comment/review line → "updated:xxxx-xx"

So the charts will be more flexible in interactions. As to the choice of filters, you may choose proper filters to replace the ones I mentioned above.

…8/hypertrons-crx into feat/add_issue_pr_interaction

# Conflicts:
#	src/views/RepoDetailIssueView/IssueChart.tsx
#	src/views/RepoDetailIssueView/RepoDetailIssueView.tsx
@frank-zsy
Copy link
Contributor

Great work, guys! Totally what I want.

Copy link
Member

@tyn1998 tyn1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! @andyhuang18

Almost done, but with some suggestions here.

}
}, []);

return <div ref={divEL} style={{ width, height }}></div>;
};

let issueclickparams: { data: number[]; marker: any; seriesName: any };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since only issueclickparams.data[0] is read as ym, maybe we can use a variable called curMonth to store the property and pass the string variable to onClick(curMonth, params) directly.

In my view this is more clear.

const tooltipFormatter = (params: any) => {
issueclickparams = params[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this line will be curMonth = params[0].data[0];

Note: in JavaScript variables are conventionally named in lowerCamelCase.

src/views/RepoDetailIssueView/RepoDetailIssueView.tsx Outdated Show resolved Hide resolved
src/views/RepoDetailIssueView/RepoDetailIssueView.tsx Outdated Show resolved Hide resolved
Copy link
Member

@tyn1998 tyn1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @andyhuang18!

/approve

@menbotics menbotics bot added the pull/approved If a pull is approved, it will be automatically merged label Nov 18, 2022
@tyn1998 tyn1998 marked this pull request as ready for review November 18, 2022 10:49
@tyn1998 tyn1998 changed the title WIP: feat: add issue and pr related interaction feat: add issue and pr related interaction Nov 18, 2022
@menbotics menbotics bot merged commit 8052b5d into hypertrons:master Nov 18, 2022
@andyhuang18 andyhuang18 deleted the feat/add_issue_pr_interaction branch March 14, 2023 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull/approved If a pull is approved, it will be automatically merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Issue and pull request related interactions
3 participants