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

refactor(shape.line): Point node generation containment #63

Merged
merged 5 commits into from
Jul 21, 2017
Merged

refactor(shape.line): Point node generation containment #63

merged 5 commits into from
Jul 21, 2017

Conversation

netil
Copy link
Member

@netil netil commented Jul 13, 2017

Issue

Ref #36

Details

Avoid creating circle nodes when set to not shown.

Normally nodes are generated as below, which even data points aren't shown still nodes area generated, which giving bad affection.

This PR makes avoiding the node generation depending the option.
Check comments below for the details.

<g class="bb-chart-lines">
   <g class="bb-chart-line bb-target bb-target-data1">
      <g class=" bb-shapes bb-shapes-data1 bb-lines bb-lines-data1">
         <path ... />
      </g>
      <g class=" bb-shapes bb-shapes-data1 bb-areas bb-areas-data1">
         <path ... />
      </g>

      <!-- 1) not generate when 'data.selection.enabled=false' or 'point.show=false' -->
      <g class=" bb-selected-circles bb-selected-circles-data1"></g>

      <!-- 2) not generate when 'point.show=false' -->    
      <g class=" bb-shapes bb-shapes-data1 bb-circles bb-circles-data1">
 	      <circle ... ></circle>
         ...
      </g>
      
   </g>

   <g class="bb-chart-line bb-target bb-target-data2" style="opacity: 1; pointer-events: none;">
	...
   </g>
</g>

Preferred reviewers

@sculove

Avoid creating circle nodes when set to not shown.

Ref #36
@netil netil added this to the 1.1.0 milestone Jul 13, 2017
@netil netil self-assigned this Jul 13, 2017
@netil netil requested a review from sculove July 13, 2017 09:59
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 1fcef35 on netil:node#36 into ** on naver:master**.

# Conflicts:
#	src/internals/shape.line.js
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 66eaac4 on netil:node#36 into ** on naver:master**.


$$.mainCircle = $$.main.selectAll(`.${CLASS.circles}`).selectAll(`.${CLASS.circle}`)
.data($$.lineOrScatterData.bind($$));
if (show) {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about returning a value in advance for code readability?

if (!$$.config.point_show) { return; }

let selectedCircles = this.main.selectAll(`.${CLASS.selectedCircle}`);
let mainCircles;
let result = [];

if (show) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@sculove
Copy link
Contributor

sculove commented Jul 18, 2017

LGTM

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a84e915 on netil:node#36 into ** on naver:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a84e915 on netil:node#36 into ** on naver:master**.

@sculove sculove merged commit 227eef4 into naver:master Jul 21, 2017
@netil netil deleted the node#36 branch July 21, 2017 07:17
@netil netil mentioned this pull request Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants