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

Axis options #53

Merged
merged 47 commits into from
Feb 26, 2019
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
70572ff
feat: more classification methods
GraceGSy Jan 16, 2019
b653166
docs: binning docs
GraceGSy Jan 16, 2019
88ccd9e
chore: push yarn.lock and package.json
GraceGSy Jan 16, 2019
d2d1c54
fix: linter
luucvanderzee Jan 16, 2019
ec05ac0
docs: adding missing plottitle docs
GraceGSy Jan 16, 2019
6cc1c97
Merge branch 'binTransformation' of https://github.com/spatialnetwork…
luucvanderzee Jan 16, 2019
0192cf5
Update docs/transform/binning.md
atepoorthuis Jan 16, 2019
20133f0
docs: fic documentation error for manual binning
GraceGSy Jan 16, 2019
03fafc3
Merge branch 'binTransformation' of https://github.com/spatialnetwork…
GraceGSy Jan 16, 2019
c13f4e4
fix: remove uniqueValues binning method
GraceGSy Jan 16, 2019
b600962
Merge branch 'master' of https://github.com/spatialnetworkslab/vue-gg…
GraceGSy Jan 17, 2019
df61aae
feat: Symbol Mark, see sandbox TestSymbol graph
GraceGSy Jan 17, 2019
5cba392
Merge branch 'master' of https://github.com/spatialnetworkslab/vue-gg…
GraceGSy Jan 17, 2019
4ec4544
docs: symbol mark demo component added to docs
GraceGSy Jan 17, 2019
6428b39
docs: filling in explanatory write-up for symbol mark
GraceGSy Jan 17, 2019
59bc392
docs: minor change in example symbol graph
GraceGSy Jan 18, 2019
4110c70
feat: tooltip + links for symbol marks
GraceGSy Jan 18, 2019
173a8bb
refactor: scaled symbol size, deprecate vgg-point
GraceGSy Jan 24, 2019
a1b3623
refactor: remove tooltip and html linking from symbol
GraceGSy Jan 24, 2019
02cac17
Merge branch 'master' of https://github.com/spatialnetworkslab/vue-gg…
GraceGSy Jan 24, 2019
7b85413
feat: additional axis style options
GraceGSy Jan 25, 2019
8a4d2bf
feat: axis titles with styling options and hjust + vjust
GraceGSy Jan 25, 2019
d993bb9
refactor: titleHjust, titleVjust, add tickSize prop
GraceGSy Jan 25, 2019
f3ba7b7
feat: preliminary work on auto positioning for axes
GraceGSy Jan 25, 2019
058bbe1
fix: hardcode positioning for when axes are on top/right
GraceGSy Jan 29, 2019
42155c5
feat: automatic positioning of axes in nested sections
GraceGSy Jan 30, 2019
686e595
feat: option to add extra tick at start of axes
GraceGSy Feb 1, 2019
f612245
docs: axis docs
GraceGSy Feb 4, 2019
340dc26
refactor: merge master, temporal variable axes still broken
GraceGSy Feb 4, 2019
582937a
refactor: extraTick logic added to tickData()
GraceGSy Feb 7, 2019
10673a2
fix: nested axes now accurately sized and positioned
GraceGSy Feb 8, 2019
bc19c47
feat: additional axis positioning options using x, y, x1, x2, y1, y2
GraceGSy Feb 8, 2019
3382f5e
docs: update axis docs, add examples
GraceGSy Feb 8, 2019
8c07afe
refactor: merge master
GraceGSy Feb 8, 2019
18cf772
fix: convert vgg-symbol to vgg-point
GraceGSy Feb 11, 2019
a88ba79
feat: rendering of label for extraTick can now be toggled
GraceGSy Feb 14, 2019
bf57a72
fix: coordinate tree updates now only apply to branch and its children
GraceGSy Feb 14, 2019
7e17667
chore: minor changes to default behavior in axes and scales
GraceGSy Feb 14, 2019
f48b732
fix: more robust logic for positioning and sizing axes using screen c…
GraceGSy Feb 26, 2019
121fe73
docs: updated axis docs, minor changes to axis code
GraceGSy Feb 26, 2019
21949c7
refactor: merge master
GraceGSy Feb 26, 2019
41b55cc
test: change axes to intersect at center as per original
GraceGSy Feb 26, 2019
dbf2d64
fix: broken SymbolMarkDemo
luucvanderzee Feb 26, 2019
5636b44
fix: change != to !==
GraceGSy Feb 26, 2019
35d19a9
Merge branch 'axis-options' of https://github.com/spatialnetworkslab/…
GraceGSy Feb 26, 2019
cd1bd4a
fix: axes x/x1/x2/w and y/y1/y2/h are now defined in local coordinates
GraceGSy Feb 26, 2019
6823277
refactor: merge master
GraceGSy Feb 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions docs/.vuepress/components/Cartesian.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<template>
<vgg-graphic
:width="600"
:height="300"
:data="data">

<vgg-section
v-if="showX"
:x1="50"
:x2="550"
:y1="25"
:y2="275"
:scale-x="'xValues'"
:scale-y="'yValues'"
>

<vgg-x-axis
:scale="'xValues'"
:tickExtra="false"
:x1="50"
:x2="550"
:vjust="0.2"
/>

<vgg-x-axis
:scale="'xValues'"
:tickExtra="false"
:x1="50"
:x2="450"
:vjust="0.5"
/>

<vgg-x-axis
:scale="'xValues'"
:tickExtra="false"
:x1="50"
:x2="250"
:vjust="0.8"
:tickCount="5"
/>

</vgg-section>

<vgg-section
v-if="showY"
:x1="50"
:x2="550"
:y1="25"
:y2="275"
:scale-x="'xValues'"
:scale-y="'yValues'"
>

<vgg-y-axis
:scale="'yValues'"
:tickExtra="false"
:y1="25"
:y2="250"
:hjust="0.2"
:tickCount="5"
/>

<vgg-y-axis
:scale="'yValues'"
:tickExtra="false"
:y1="50"
:y2="225"
:hjust="0.5"
:tickCount="5"
/>

<vgg-y-axis
:scale="'yValues'"
:tickExtra="false"
:y1="100"
:y2="175"
:hjust="0.8"
:tickCount="5"
/>

</vgg-section>

<vgg-section
v-if="showAll"
:x1="50"
:x2="550"
:y1="25"
:y2="250"
:scale-x="'xValues'"
:scale-y="'yValues'"
>

<vgg-x-axis
:scale="'xValues'"
title="x axis"
:tickExtra="false"
:titleHjust="1.05"
/>

<vgg-y-axis
:scale="'yValues'"
:tickExtra="false"
:tickCount="5"
title="y axis"
/>

</vgg-section>

</vgg-graphic>
</template>

<script>
export default {
props: {
showX : {
default: false
},

showY : {
default: false
},

showAll : {
default: false
}
},

computed: {
data () {
let colors = ['red', 'blue', 'green']
let data = { colors: [], xValues: [], yValues: [] }
for (let i = 0; i < 30; i++) {
let colorIndex = Math.floor(Math.random() * 3)
let color = colors[colorIndex]

data.colors.push(color)
data.xValues.push(Math.random() * 10)
data.yValues.push(Math.random() * 100)
}

return data
}
}
}
</script>
30 changes: 13 additions & 17 deletions docs/.vuepress/components/SymbolMarkDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,20 @@
:fill="fill"
:stroke-width="1"
/>

</vgg-map>

<vgg-x-axis
:scale="[0, 150]"
:vjust="-.05"
/>

<vgg-y-axis
:scale="'dependent'"
:hjust="-.05"
flip
/>

</vgg-section>

<vgg-x-grid
Expand All @@ -44,22 +56,6 @@
:scale="'dependent'"
/>

<vgg-x-axis
:x1="100"
:x2="500"
:y1="0"
:y2="50"
:scale="'explanatory'"
/>

<vgg-y-axis
:x1="500"
:x2="550"
:y1="50"
:y2="450"
:scale="'dependent'"
/>

</vgg-graphic>

<br />
Expand Down Expand Up @@ -102,7 +98,7 @@ export default {
computed : {
fill () {
if (this.color === 'both' || this.color === 'fill') {
return { scale: { scale: 'viridis', variable: 'explanatory' } }
return { get: 'explanatory', scale: { type: 'viridis', domain: 'explanatory' } }
} else {
return 'none'
}
Expand Down
117 changes: 102 additions & 15 deletions docs/axes/cartesian.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,114 @@
title: Cartesian Axes
---

# Cartesian Axes
# Component tag

<div>
<cartesianaxes></cartesianaxes>
</div>
`<vgg-x-axis>`

The standard axis takes the following props:
`<vgg-y-axis>`

Prop | Required | Default | Description
----------|----------|-----------|----------------------------
| | |

# Description

<br />
Axes are used as reference scales for values in the graph. Each axis is typically mapped to a single dimension or variable.

### Axis Domain
# Props

### Multi-axis
| Prop | Required | Regular types | Default | Description |
| ------ | -------- | ----------------------- | --------- | --------------------------------------------------------- |
| scale | true | [Array, String, Object] | undefined | range of values covered by the axis, can be variable name |
| flip | false | [Boolean] | false | direction of tick and axis labels |

### Gridlines
### X Axis Positioning

### Format Tick Values
There are three options for positioning the x axis on the graph. The `y` prop takes precedence, followed by `y1` and `y2`, lastly `vjust` encodes default behavior.

### Custom Ticks
When using `y` or `vjust`, the x axis defaults to a height of 100px.

| Prop | Required | Regular types | Default | Description | Unit(s) |
| ---- | -------- | ---------------- | --------- | --------------------------------------- | ---------------------- |
| vjust| false | [Number, String] | 'b' | position of x axis | Number between 0 and 1 |
| y | false | [Number] | undefined | position of x axis | Screen pixels |
GraceGSy marked this conversation as resolved.
Show resolved Hide resolved
| y1 | false | [Number] | undefined | starting y coordinate of x axis | Screen pixels |
| y2 | false | [Number] | undefined | ending y coordinate of x axis | Screen pixels |

By default the x axis spans the entire width of the section. To customize the width of the x axis, it is possible to provide `x1` and `x2` as start and end coordinates.

| Prop | Required | Regular types | Default | Description | Unit(s) |
| ---- | -------- | ---------------- | --------- | --------------------------------------- | --------------------- |
| x1 | false | [Number] | undefined | starting x coordinate of x axis | Screen pixels |
| x2 | false | [Number] | undefined | ending x coordinate of x axis | Screen pixels |

<cartesian :showX="true" />

### Y Axis Positioning

Similar to the x axis, there are three options for positioning the y axis on the graph. The `x` prop takes precedence, followed by `x1` and `x2`, lastly `hjust` encodes default behavior.

When using `x` or `hjust`, the y axis defaults to a width of 100px.

| Prop | Required | Regular types | Default | Description | Unit(s) |
| ---- | -------- | ---------------- | --------- | --------------------------------------- | ---------------------- |
| hjust| false | [Number, String] | 'l' | position of y axis | Number between 0 and 1 |
| x | false | [Number] | undefined | position of y axis | Screen pixels |
| x1 | false | [Number] | undefined | starting x coordinate of y axis | Screen pixels |
| x2 | false | [Number] | undefined | ending x coordinate of y axis | Screen pixels |

By default the y axis spans the entire height of the section. To customize the height of the y axis, it is possible to provide `y1` and `y2` as start and end coordinates.

| Prop | Required | Regular types | Default | Description | Unit(s) |
| ---- | -------- | ---------------- | --------- | --------------------------------------- | --------------------- |
| y1 | false | [Number] | undefined | starting y coordinate of y axis | Screen pixels |
| y2 | false | [Number] | undefined | ending y coordinate of y axis | Screen pixels |

<cartesian :showY="true" />

### Main Line

| Prop | Required | Regular types | Default | Description | Unit(s) |
| -------------- | -------- | ---------------- | --------- | --------------------------------------- | -------------------------- |
| domain | false | [Boolean] | true | if true render axis main line | |
| domainColor | false | [String] | 'black' | color of main line | Named color, hex, rgb, hsl |
| domainOpacity | false | [Number] | 1 | opacity of main line | Number between 0 and 1 |
| domainWidth | false | [Number] | 1 | stroke width of main line | Screen pixels |

### Labels

| Prop | Required | Regular types | Default | Description | Unit(s) |
| -------------- | -------- | ------------------ | ----------- | --------------------------------------- | -------------------------- |
| labels | false | [Boolean] | true | if true render labels | |
| format | false | [String, Function] | undefined | formatting of axis labels | |
| labelColor | false | [String] | 'black' | color of labels | Named color, hex, rgb, hsl |
| labelFont | false | [String] | 'Helvetica' | font used for axis labels | Named font |
| labelFontSize | false | [Number] | 10 | size of font used for axis labels | Screen pixels |
| labelFontWeight| false | [String, Number] | 'normal' | weight of font used for axis labels | Any valid css font weight |
| labelOpacity | false | [Number] | 1 | opacity of labels | Number between 0 and 1 |
| labelRotate | false | [Boolean] | false | if true rotate labels | Degrees |

### Ticks

| Prop | Required | Regular types | Default | Description | Unit(s) |
| -------------- | -------- | ---------------- | ----------- | ---------------------------------------------- | -------------------------- |
| ticks | false | [Boolean] | true | if true render ticks | |
| tickColor | false | [String] | 'black' | color of ticks | Named color, hex, rgb, hsl |
| tickValues | false | [Array] | undefined | custom tick positions | |
| tickCount | false | [Number] | 10 | number of ticks on the axis, equal intervals | |
| tickExtra | false | [Boolean] | true | if true, render extra tick at axis origin | |
| tickOpacity | false | [Number] | 1 | opacity of ticks | Number between 0 and 1 |
| tickSize | false | [Number] | 7 | length of ticks | Screen pixels |
| tickWidth | false | [Number] | 0.5 | stroke width of ticks | Screen pixels |

### Title

| Prop | Required | Regular types | Default | Description | Unit(s) |
| --------------- | -------- | ---------------- | ----------- | --------------------------------------- | -------------------------- |
| titleHjust | false | [String, Number] | depends | position of axis title relative to axis; default -0.08 for x-axis; default 'center' for y-axis | Number between 0 and 1 |
| titleVjust | false | [String, Number] | depends | position of axis title relative to axis; default 'center' for x-axis; default 1.05 for y-axis | Number between 0 and 1 |
| title | false | [String] | '' | text to render as axis title | |
| titleAnchorPoint| false | [String] | 'center' | baseline and alignment of title text | |
| titleColor | false | [String] | 'black' | color of title | Named color, hex, rgb, hsl |
| titleFont | false | [String] | 'Helvetica' | font used for axis title | Named font |
| titleFontSize | false | [Number] | 12 | size of font used for axis title | Screen pixels |
| titleFontWeight | false | [String, Number] | 'normal' | weight of font used for axis title | Any valid css font weight |
| titleOpacity | false | [Number] | 1 | opacity of title | Number between 0 and 1 |

<cartesian :showAll="true" />
2 changes: 2 additions & 0 deletions docs/marks/symbol.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Symbol Mark

# Component tag

`<vgg-symbol>`

`<vgg-point>`

# Description
Expand Down
Loading