Skip to content

Commit

Permalink
Update CustomSVGSeries to use getX / getY (uber#1051)
Browse files Browse the repository at this point in the history
* Update CustomSVGSeries to use getX / getY

* Updated an example to showcase getX / getY
  • Loading branch information
SinZ163 authored and mcnuttandrew committed Dec 31, 2018
1 parent cb40485 commit c820b41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions showcase/plot/custom-svg-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {

export default function Example(props) {
return (
<XYPlot width={300} height={300}>
<XYPlot width={300} height={300} getY={d => d.value}>
<VerticalGridLines />
<HorizontalGridLines />
<XAxis />
Expand All @@ -40,13 +40,13 @@ export default function Example(props) {
className="custom-marking"
customComponent="square"
data={[
{x: 1, y: 10, customComponent: 'circle', size: 10},
{x: 1.7, y: 12, size: 20, style: {stroke: 'red', fill: 'orange'}},
{x: 2, y: 5},
{x: 3, y: 15},
{x: 1, value: 10, customComponent: 'circle', size: 10},
{x: 1.7, value: 12, size: 20, style: {stroke: 'red', fill: 'orange'}},
{x: 2, value: 5},
{x: 3, value: 15},
{
x: 2.5,
y: 7,
value: 7,
customComponent: (row, positionInPixels, globalStyle) => {
return (
<g className="inner-inner-component">
Expand Down
4 changes: 2 additions & 2 deletions src/plot/series/custom-svg-series.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ class CustomSVGSeries extends AbstractSeries {
const y = this._getAttributeFunctor('y');
const contents = data.map((seriesComponent, index) => {
const positionInPixels = {
x: x({x: seriesComponent.x}),
y: y({y: seriesComponent.y})
x: x(seriesComponent),
y: y(seriesComponent)
};
const innerComponent = getInnerComponent({
customComponent: seriesComponent,
Expand Down

0 comments on commit c820b41

Please sign in to comment.