@react-financial-charts/coordinates
Advanced tools
Comparing version 1.0.0-alpha.7 to 1.0.0-alpha.8
@@ -6,2 +6,19 @@ # Change Log | ||
# [1.0.0-alpha.8](https://github.com/reactivemarkets/react-financial-charts/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2020-08-17) | ||
### Bug Fixes | ||
* correcting prop types and docs ([198f0a5](https://github.com/reactivemarkets/react-financial-charts/commit/198f0a54dae54075383c25dca67ff48d5e5a1b2a)) | ||
* removing explict returns ([999b5ac](https://github.com/reactivemarkets/react-financial-charts/commit/999b5acb8d1669406e3d8be813d831e20151c87f)) | ||
### Features | ||
* exporting props from components for docs ([fbdaea5](https://github.com/reactivemarkets/react-financial-charts/commit/fbdaea506730b091f4f8f6da52fc030b44d1a6e1)) | ||
# [1.0.0-alpha.7](https://github.com/reactivemarkets/react-financial-charts/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2020-07-26) | ||
@@ -8,0 +25,0 @@ |
import * as PropTypes from "prop-types"; | ||
import * as React from "react"; | ||
import { strokeDashTypes } from "@react-financial-charts/core"; | ||
interface CrossHairCursorProps { | ||
readonly className?: string; | ||
export interface CrossHairCursorProps { | ||
readonly customX?: (props: CrossHairCursorProps, moreProps: any) => number; | ||
@@ -14,3 +13,2 @@ readonly snapX?: boolean; | ||
static defaultProps: { | ||
className: string; | ||
customX: (props: CrossHairCursorProps, moreProps: any) => any; | ||
@@ -30,2 +28,1 @@ snapX: boolean; | ||
} | ||
export {}; |
@@ -70,3 +70,2 @@ import * as PropTypes from "prop-types"; | ||
CrossHairCursor.defaultProps = { | ||
className: "react-financial-charts-crosshair", | ||
customX: defaultCustomX, | ||
@@ -73,0 +72,0 @@ snapX: true, |
import * as React from "react"; | ||
interface CurrentCoordinateProps { | ||
readonly className?: string; | ||
readonly fill?: string | ((dataItem: any) => string); | ||
export interface CurrentCoordinateProps { | ||
readonly fillStyle?: string | CanvasGradient | CanvasPattern | ((datum: any) => string | CanvasGradient | CanvasPattern); | ||
readonly r: number; | ||
@@ -11,3 +10,2 @@ readonly yAccessor: (item: any) => number; | ||
r: number; | ||
className: string; | ||
}; | ||
@@ -18,2 +16,1 @@ render(): JSX.Element; | ||
} | ||
export {}; |
@@ -7,7 +7,8 @@ import { getMouseCanvas, GenericChartComponent } from "@react-financial-charts/core"; | ||
this.drawOnCanvas = (ctx, moreProps) => { | ||
const circle = this.getCircle(this.props, moreProps); | ||
const circle = this.getCircle(moreProps); | ||
if (circle === undefined) { | ||
return; | ||
} | ||
const fillColor = circle.fill instanceof Function ? circle.fill(moreProps.currentItem) : circle.fill; | ||
const { fillStyle, r } = this.props; | ||
const fillColor = fillStyle instanceof Function ? fillStyle(moreProps.currentItem) : fillStyle; | ||
if (fillColor !== undefined) { | ||
@@ -17,7 +18,6 @@ ctx.fillStyle = fillColor; | ||
ctx.beginPath(); | ||
ctx.arc(circle.x, circle.y, circle.r, 0, 2 * Math.PI, false); | ||
ctx.arc(circle.x, circle.y, r, 0, 2 * Math.PI, false); | ||
ctx.fill(); | ||
}; | ||
this.getCircle = (props, moreProps) => { | ||
const { fill, yAccessor, r } = props; | ||
this.getCircle = (moreProps) => { | ||
const { show, xScale, chartConfig: { yScale }, currentItem, xAccessor, } = moreProps; | ||
@@ -27,2 +27,3 @@ if (!show || currentItem === undefined) { | ||
} | ||
const { yAccessor } = this.props; | ||
const xValue = xAccessor(currentItem); | ||
@@ -35,3 +36,3 @@ const yValue = yAccessor(currentItem); | ||
const y = Math.round(yScale(yValue)); | ||
return { x, y, r, fill }; | ||
return { x, y }; | ||
}; | ||
@@ -45,4 +46,3 @@ } | ||
r: 3, | ||
className: "react-financial-charts-current-coordinate", | ||
}; | ||
//# sourceMappingURL=CurrentCoordinate.js.map |
import { strokeDashTypes } from "@react-financial-charts/core"; | ||
import * as PropTypes from "prop-types"; | ||
import * as React from "react"; | ||
interface CursorProps { | ||
readonly className?: string; | ||
export interface CursorProps { | ||
readonly disableYCursor?: boolean; | ||
@@ -17,3 +16,3 @@ readonly opacity?: number; | ||
} | ||
declare class Cursor extends React.Component<CursorProps> { | ||
export declare class Cursor extends React.Component<CursorProps> { | ||
static defaultProps: { | ||
@@ -41,2 +40,1 @@ stroke: string; | ||
} | ||
export default Cursor; |
@@ -10,3 +10,3 @@ import { colorToRGBA, first, getStrokeDasharrayCanvas, GenericComponent, getMouseCanvas, isNotDefined, last, } from "@react-financial-charts/core"; | ||
}; | ||
class Cursor extends React.Component { | ||
export class Cursor extends React.Component { | ||
constructor() { | ||
@@ -125,3 +125,2 @@ super(...arguments); | ||
}; | ||
export default Cursor; | ||
//# sourceMappingURL=Cursor.js.map |
import * as React from "react"; | ||
interface EdgeCoordinateProps { | ||
export interface EdgeCoordinateProps { | ||
readonly className?: string; | ||
@@ -35,2 +35,1 @@ readonly type: "vertical" | "horizontal"; | ||
} | ||
export {}; |
/// <reference types="react" /> | ||
export declare function renderSVG(props: any): JSX.Element | null; | ||
export declare function drawOnCanvas(ctx: CanvasRenderingContext2D, props: any): void; | ||
export declare const renderSVG: (props: any) => JSX.Element | null; | ||
export declare const drawOnCanvas: (ctx: CanvasRenderingContext2D, props: any) => void; |
import * as React from "react"; | ||
import { colorToRGBA, getStrokeDasharray, getStrokeDasharrayCanvas, isDefined } from "@react-financial-charts/core"; | ||
export function renderSVG(props) { | ||
export const renderSVG = (props) => { | ||
const { className } = props; | ||
@@ -29,4 +29,4 @@ const edge = helper(props); | ||
coordinate)); | ||
} | ||
function helper(props) { | ||
}; | ||
const helper = (props) => { | ||
const { coordinate: displayCoordinate, show, type, orient, edgeAt, hideLine, lineStrokeDasharray, fill, opacity, fontFamily, fontSize, textFill, lineStroke, lineOpacity, stroke, strokeOpacity, strokeWidth, arrowWidth, rectWidth, rectHeight, rectRadius, x1, y1, x2, y2, dx, } = props; | ||
@@ -98,9 +98,9 @@ if (!show) { | ||
}; | ||
} | ||
export function drawOnCanvas(ctx, props) { | ||
const { coordinate, fontSize, fontFamily } = props; | ||
}; | ||
export const drawOnCanvas = (ctx, props) => { | ||
const { coordinate, fitToText, fontSize, fontFamily, rectWidth } = props; | ||
ctx.font = `${fontSize}px ${fontFamily}`; | ||
ctx.textBaseline = "middle"; | ||
let width = props.rectWidth; | ||
if (props.fitToText) { | ||
let width = rectWidth; | ||
if (fitToText) { | ||
width = Math.round(ctx.measureText(coordinate).width + 10); | ||
@@ -165,4 +165,4 @@ } | ||
} | ||
} | ||
function roundRect(ctx, x, y, width, height, radius) { | ||
}; | ||
const roundRect = (ctx, x, y, width, height, radius) => { | ||
ctx.beginPath(); | ||
@@ -179,3 +179,3 @@ ctx.moveTo(x + radius, y); | ||
ctx.closePath(); | ||
} | ||
}; | ||
//# sourceMappingURL=EdgeCoordinateV3.js.map |
import * as React from "react"; | ||
import { strokeDashTypes } from "@react-financial-charts/core"; | ||
interface EdgeIndicatorProps { | ||
export interface EdgeIndicatorProps { | ||
readonly arrowWidth?: number; | ||
readonly className?: string; | ||
readonly displayFormat?: any; | ||
readonly displayFormat?: (n: number) => string; | ||
readonly edgeAt?: "left" | "right"; | ||
@@ -22,3 +21,2 @@ readonly fill?: string | any; | ||
static defaultProps: { | ||
className: string; | ||
type: string; | ||
@@ -54,2 +52,1 @@ fitToText: boolean; | ||
} | ||
export {}; |
@@ -59,3 +59,2 @@ import { format } from "d3-format"; | ||
EdgeIndicator.defaultProps = { | ||
className: "react-financial-charts-edgeindicator", | ||
type: "horizontal", | ||
@@ -62,0 +61,0 @@ fitToText: false, |
export * from "./EdgeIndicator"; | ||
export * from "./CrossHairCursor"; | ||
export * from "./CurrentCoordinate"; | ||
export * from "./Cursor"; | ||
export * from "./MouseCoordinateX"; | ||
export { MouseCoordinateXV2 } from "./MouseCoordinateXV2"; | ||
export { MouseCoordinateY } from "./MouseCoordinateY"; | ||
export * from "./CrossHairCursor"; | ||
export * from "./PriceCoordinate"; |
export * from "./EdgeIndicator"; | ||
export * from "./CrossHairCursor"; | ||
export * from "./CurrentCoordinate"; | ||
export * from "./Cursor"; | ||
export * from "./MouseCoordinateX"; | ||
export { MouseCoordinateXV2 } from "./MouseCoordinateXV2"; | ||
export { MouseCoordinateY } from "./MouseCoordinateY"; | ||
export * from "./CrossHairCursor"; | ||
export * from "./PriceCoordinate"; | ||
//# sourceMappingURL=index.js.map |
import * as React from "react"; | ||
interface MouseCoordinateXProps { | ||
export interface MouseCoordinateXProps { | ||
readonly at?: "bottom" | "top"; | ||
@@ -50,2 +50,1 @@ readonly customX: (props: MouseCoordinateXProps, moreProps: any) => { | ||
} | ||
export {}; |
@@ -19,3 +19,3 @@ import * as React from "react"; | ||
if (isNotDefined(props)) { | ||
return null; | ||
return; | ||
} | ||
@@ -22,0 +22,0 @@ drawOnCanvas(ctx, props); |
@@ -9,13 +9,13 @@ import * as React from "react"; | ||
readonly text?: { | ||
fontStyle: string; | ||
fontWeight: string; | ||
fontFamily: string; | ||
fontSize: number; | ||
fill: string | any; | ||
readonly fontStyle: string; | ||
readonly fontWeight: string; | ||
readonly fontFamily: string; | ||
readonly fontSize: number; | ||
readonly fill: string | any; | ||
}; | ||
readonly bg: { | ||
fill: string | any; | ||
stroke: string; | ||
strokeWidth: number; | ||
padding: { | ||
readonly fill: string | any; | ||
readonly stroke: string; | ||
readonly strokeWidth: number; | ||
readonly padding: { | ||
left: number; | ||
@@ -22,0 +22,0 @@ right: number; |
import * as React from "react"; | ||
interface MouseCoordinateYProps { | ||
export interface MouseCoordinateYProps { | ||
readonly arrowWidth?: number; | ||
@@ -67,2 +67,1 @@ readonly at?: "left" | "right"; | ||
}; | ||
export {}; |
@@ -10,3 +10,3 @@ import * as React from "react"; | ||
if (isNotDefined(props)) { | ||
return null; | ||
return; | ||
} | ||
@@ -13,0 +13,0 @@ drawOnCanvas(ctx, props); |
@@ -12,4 +12,3 @@ import * as React from "react"; | ||
this.helper = (props, moreProps) => { | ||
const { width } = moreProps; | ||
const { chartConfig: { yScale }, } = moreProps; | ||
const { chartConfig: { yScale }, width, } = moreProps; | ||
const [lowerYValue, upperYValue] = yScale.domain(); | ||
@@ -16,0 +15,0 @@ const { price, stroke, strokeDasharray, strokeOpacity, strokeWidth } = props; |
{ | ||
"name": "@react-financial-charts/coordinates", | ||
"version": "1.0.0-alpha.7", | ||
"version": "1.0.0-alpha.8", | ||
"description": "Coordinates for react-financial-charts", | ||
@@ -41,5 +41,5 @@ "publishConfig": { | ||
"dependencies": { | ||
"@react-financial-charts/core": "^1.0.0-alpha.7", | ||
"d3-format": "1.4.4", | ||
"prop-types": "15.7.2" | ||
"@react-financial-charts/core": "^1.0.0-alpha.8", | ||
"d3-format": "^1.4.4", | ||
"prop-types": "^15.7.2" | ||
}, | ||
@@ -50,3 +50,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "71acd57b6a52ae3fd2376fc19153d2a4f78079c3" | ||
"gitHead": "fc4f25cf7ad3c460cc510a0d63fd5b1a1ad547b5" | ||
} |
export * from "./EdgeIndicator"; | ||
export * from "./CrossHairCursor"; | ||
export * from "./CurrentCoordinate"; | ||
export * from "./Cursor"; | ||
export * from "./MouseCoordinateX"; | ||
export { MouseCoordinateXV2 } from "./MouseCoordinateXV2"; | ||
export { MouseCoordinateY } from "./MouseCoordinateY"; | ||
export * from "./CrossHairCursor"; | ||
export * from "./PriceCoordinate"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
165028
3123
+ Addedd3-format@1.4.5(transitive)
+ Addedprop-types@15.8.1(transitive)
- Removedd3-format@1.4.4(transitive)
- Removedprop-types@15.7.2(transitive)
Updatedd3-format@^1.4.4
Updatedprop-types@^15.7.2