Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Events#45

Merged
cryogenian merged 5 commits intoslamdata:masterfrom
cryogenian:events
Sep 7, 2017
Merged

Events#45
cryogenian merged 5 commits intoslamdata:masterfrom
cryogenian:events

Conversation

@cryogenian
Copy link
Copy Markdown
Member

This adds some types to events, modifies brush event on during catching (this is needed to reconstruct data in SD) and adds some commands for brush.

@safareli Please review

return function(el) {
return function() {
return echarts.init(el, theme);
return echarts.init(el,theme);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

space ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch!

brush = set "brush" <<< buildObj

brushType ∷ ∀ i. DSL TP.BrushToolboxI → DSL (brushType ∷ I|i)
brushType a = set "type" $ buildArr a
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't "type" be "brushType"? and same beloved for some other cases

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's by design, too much type fields in js. But they all are different: e.g. type for brush, type for series, type for events etc. So, in built options this is just "type": ["blahblah"] but that blahblah may be used only in brush context.

callback(e)();
});
var modifiedE = eName === "brush" ? addAll(this.getOption(), e) : e;
callback(modifiedE)();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm fine with this, but as addAll is still mutating event, it can be written like this:

if (eName === "brush") {
  addAll(this.getOption(), e);
}
callback(e)();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍

if (keysArr.indexOf(key) == -1) {
value = rawAction[key];
} else {
value = maybe(undefined)(function(x) {return x;})(rawAction[key]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can pass fromMaybe instead of maybe (based on it's usage).
rawAction is normal js object right? so why do we need maybe for rawAction[key]? Also maybe is used only here not in upper branch, why?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

rawAction is purescript object :) I'll switch to fromMaybe

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah so maybeKeys is from type to array of such keys which contain js values wrapped in maybe? in various EChartsEvents I couldn't see any Maybe field

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

like dataIndex is just Int so, where the Maybe comes from

@@ -1,11 +1,123 @@
function addData(area, axis, setKey) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do not understand what's going on in this functions, so cant really review it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

An event raised during selection of some area of chart. This event has area fields. These funcs adds params extracted from chart option to the event.

import Math (cos, sin, (%))

import Utils as U
import Unsafe.Coerce (unsafeCoerce)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unused?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks 👍

@cryogenian
Copy link
Copy Markdown
Member Author

  • Space in initImpl
  • Removed maybe from dispatch
  • Removed ternary operator
  • Removed unused import

@safareli Good to go?


foreign import dispatchAction_
∷ ∀ e action
. action
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we change action to be { type ∷ String | r }?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Discussed in Slack

"unfocusnodeadjacency" → "unfocusNodeAdjacency"
s → s

action ∷ ∀ ω. { "type" ∷ String | ω }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need qoutes here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep. At least w/o it my editor is going crazy

@cryogenian cryogenian merged commit 12eba86 into slamdata:master Sep 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants