Search
Preparing search index...
The search index is not available
catreact-html
Options
All
Public
Public/Protected
All
Inherited
Externals
Only exported
Menu
Globals
"ext/CvGraphPanel"
External module "ext/CvGraphPanel"
Index
Interfaces
Cv
Bar
Chart
Props
Cv
Chart
Props
Cv
Graph
Panel
Props
Cv
Graph
Panel
State
Cv
Graph
Props
Cv
Graph
State
Cv
Pie
Chart
Props
Cv
Scatter
Chart
Props
Variables
CV_
GRAPH_
DEFAULT_
COLORS
Cv
Bar
Chart
Cv
Graph
Cv
Graph
Panel
Cv
Line
Chart
Cv
Pie
Chart
Cv
Scatter
Chart
Object literals
Cv
Chart
Variables
CV_
GRAPH_
DEFAULT_
COLORS
CV_
GRAPH_
DEFAULT_
COLORS
:
string
[]
= ['#1E6FF2', '#F29500', '#15BFA2', '#6F5F5A']
Cv
Bar
Chart
Cv
Bar
Chart
:
ClassicComponentClass
<
CvBarChartProps
>
= React.createClass<CvBarChartProps, {}>({mixins: [CvChart],render: function () {const graphDef = this.props.graphContext.graphDef;const {minX, maxX, minY, maxY, xAxisLabel, yAxisLabel} = this.getMetaValues(graphDef, this.props.data);const xType = this.isNumeric(this.props.graphContext, graphDef.identityDataPointDef.name, this.props.data) ? 'numeric' : 'category';const yType = this.isNumeric(this.props.graphContext, graphDef.dataPointDefs[0].name, this.props.data) ? 'numeric' : 'category';return (<div className="cv-graph-container"><ResponsiveContainer width="99%" height="95%"><BarChart data={this.props.data} margin={{top: 20, right: 50, left: 20, bottom: 5}}><XAxis dataKey={this.props.identPropName} domain={[minX, maxX]} label={xAxisLabel} /><YAxis domain={[minY, maxY]} label={yAxisLabel} /><CartesianGrid strokeDasharray="3 3"/><Tooltip/><Legend />{graphDef.dataPointDefs.map((dataPointDef:GraphDataPointDef, i:number)=>{const legendKey = dataPointDef.legendKey || dataPointDef.name;const props = {dataKey:dataPointDef.name,name:legendKey,fill:this.colorForDataPointDef(dataPointDef, i),onClick:(data)=>{this.handleClick(data.id)},key:i};if(this.props.stack) props['stackId'] = 'a';return <Bar {...props}/>})}</BarChart></ResponsiveContainer></div>);}})
Cv
Graph
Cv
Graph
:
ClassicComponentClass
<
CvGraphProps
>
= React.createClass<CvGraphProps, CvGraphState>({mixins: [CvBaseMixin],componentDidMount: function () {},getDefaultProps: function () {return {graphContext: null,lastRefreshTime: null,navigationListeners: [],selectionListener: null,stateChangeListeners: [],actionListeners: [],defaultSeriesColors: CV_GRAPH_DEFAULT_COLORS,navTarget: null,}},getInitialState: function () {return {}},render: function () {const graphContext:GraphContext = this.props.graphContext;const selectionAdapter:CvValueAdapter<Array<string>> = new CvValueAdapter<Array<string>>();const selectionListener:CvValueListener<Array<string>> = selectionAdapter.createValueListener();return <CvAction actionId={graphContext.graphDef.defaultActionId}paneContext={graphContext}navigationListeners={this.props.navigationListeners}actionListeners={this.props.actionListeners}stateChangeListeners={this.props.stateChangeListeners}selectionProvider={selectionAdapter}renderer={(cvContext:CvContext, callback?:CvActionCallback)=>{const clickHandler = (id:string) => { selectionListener([id]); callback.fireAction();}const graphDef:GraphDef = graphContext.graphDef;const records:Array<EntityRec> = ArrayUtil.copy<EntityRec>(graphContext.scroller.buffer);const points:Array<any> = graphDef.graphType === GraphDef.GRAPH_TYPE_PIE ?this._generateDataForPieChart(graphContext, records) : this._generateData(graphContext, records);const identPropName = graphDef.identityDataPointDef.name;const plotTypes = graphDef.dataPointDefs.map((dataPointDef:GraphDataPointDef)=>{ return dataPointDef.plotType }).filter((v:string)=>{ return !!v; });if(graphDef.graphType === GraphDef.GRAPH_TYPE_CARTESIAN) {if (plotTypes.length === 0 || plotTypes.indexOf(GraphDef.PLOT_TYPE_BAR) > -1){return <CvBarChart graphContext={graphContext} data={points} identPropName={identPropName}defaultSeriesColors={this.props.defaultSeriesColors} clickHandler={clickHandler}/>} else if(plotTypes.indexOf(GraphDef.PLOT_TYPE_LINE) > -1) {return <CvLineChart graphContext={graphContext} data={points} identPropName={identPropName}defaultSeriesColors={this.props.defaultSeriesColors} clickHandler={clickHandler}/>} else if(plotTypes.indexOf(GraphDef.PLOT_TYPE_STACKED) > -1) {return <CvBarChart graphContext={graphContext} data={points} identPropName={identPropName}defaultSeriesColors={this.props.defaultSeriesColors} stack={true} clickHandler={clickHandler}/>} else if(plotTypes.indexOf(GraphDef.PLOT_TYPE_SCATTER) > -1) {return <CvScatterChart graphContext={graphContext} data={points} identPropName={identPropName}defaultSeriesColors={this.props.defaultSeriesColors} clickHandler={clickHandler}/>}else if(plotTypes.indexOf(GraphDef.PLOT_TYPE_BUBBLE) > -1 ) {return <CvScatterChart graphContext={graphContext} data={points} identPropName={identPropName}defaultSeriesColors={this.props.defaultSeriesColors} bubble={true} clickHandler={clickHandler}/>} else {return null;}} else if(graphDef.graphType === GraphDef.GRAPH_TYPE_PIE) {return <CvPieChart graphContext={graphContext} data={points} identPropName={identPropName}defaultSeriesColors={this.props.defaultSeriesColors} clickHandler={clickHandler}/>} else {return null;}}}/>},shouldComponentUpdate(nextProps, nextState) {/*This is an 'inclusive' change list - updates DO NOT happen by defaultDesired updates should be explicitly added here*///update if we have new list dataif (nextProps.lastRefreshTime) {if (this.props.lastRefreshTime) {if (nextProps.lastRefreshTime.getTime() > this.props.lastRefreshTime.getTime()) {return true;}} else {return true;}}return false;},_formatProp: function(prop:Prop, propDef:PropDef) {if(propDef) {const formattedProp:string = (CvProp as any).formatDataType(prop, propDef);return propDef.isNumericType ? Number(formattedProp) : formattedProp;} else {if(typeof prop.value !== 'number') {return (CvProp as any).formatDataType(prop, null);} else {return prop.value;}}},_generateData: function(graphContext:GraphContext, records:Array<EntityRec>):Array<any> {const graphDef:GraphDef = graphContext.graphDef;//prop for 1 axis (or dimension)const identPropName = graphDef.identityDataPointDef.name;const points = records.map((record:EntityRec)=>{const item = {}item['id'] = record.objectId;item[identPropName] = this._formatProp(record.propAtName(identPropName), graphContext.propDefAtName(identPropName));//possible props for other axes (or dimensions)graphDef.dataPointDefs.forEach((dataPointDef:GraphDataPointDef)=>{const propName = dataPointDef.name;if(propName) item[propName] = this._formatProp(record.propAtName(propName), graphContext.propDefAtName(propName));const xAxisName = dataPointDef.xAxisName;if(xAxisName) item[xAxisName] = this._formatProp(record.propAtName(xAxisName), graphContext.propDefAtName(xAxisName));const radiusName = dataPointDef.bubbleRadiusName;if(radiusName) item[radiusName] = Number(record.propAtName(radiusName).value);});return item;});return points;},_generateDataForPieChart: function(graphContext:GraphContext, records:Array<EntityRec>) {/* The pie chart requires the primary series to be numeric */const graphDef:GraphDef = graphContext.graphDef;//prop for 1 axis (or dimension)const identPropName = graphDef.identityDataPointDef.name;const points = records.map((record:EntityRec)=>{const item = {}item['id'] = record.objectId;item[identPropName] = this._formatProp(record.propAtName(identPropName), graphContext.propDefAtName(identPropName));graphDef.dataPointDefs.forEach((dataPointDef:GraphDataPointDef)=>{const propName = dataPointDef.name;//force numeric typingif(propName) item[propName] = Number(record.propAtName(propName).value);});return item;});return points;},})
Cv
Graph
Panel
Cv
Graph
Panel
:
ClassicComponentClass
<
CvGraphPanelProps
>
= React.createClass<CvGraphPanelProps, CvGraphPanelState>({mixins: [CvBaseMixin],componentDidMount: function () {},getDefaultProps: function () {return {paneRef: null,formContext: null,graphContext: null,navigationListeners: [],selectionListener: null,stateChangeListeners: [],actionListeners: [],defaultSeriesColors: CV_GRAPH_DEFAULT_COLORS,navTarget: null,actionProvider: null}},getInitialState: function () {return {}},render: function () {const {} = this.state;const graphPaneProps = {paneRef: this.props.paneRef,formContext: this.props.formContext,queryContext: this.props.graphContext,stateChangeListeners: this.props.stateChangeListeners,actionListeners: this.props.actionListeners,actionProvider: this.props.actionProvider}return (<CvQueryPane {...graphPaneProps} queryRenderer={(cvContext:CvContext, callback:CvQueryPaneCallback)=>{const graphContext:GraphContext = cvContext.scopeCtx.scopeObj;return <CvGraph graphContext={graphContext}lastRefreshTime={graphContext.lastRefreshTime}navigationListeners={this.props.navigationListeners}selectionListener={this.props.selectionListener}actionListeners={this.props.actionListeners}stateChangeListeners={this.props.stateChangeListeners}navTarget={this.props.navTarget}defaultSeriesColors={this.props.defaultSeriesColors}/>}}/>);},})
Cv
Line
Chart
Cv
Line
Chart
:
ClassicComponentClass
<
CvChartProps
>
= React.createClass<CvChartProps, {}>({mixins: [CvChart],render: function () {const graphDef = this.props.graphContext.graphDef;const {minX, maxX, minY, maxY, xAxisLabel, yAxisLabel} = this.getMetaValues(graphDef, this.props.data);const xType = this.isNumeric(this.props.graphContext, graphDef.identityDataPointDef.name, this.props.data) ? 'number' : 'category';const yType = this.isNumeric(this.props.graphContext, graphDef.dataPointDefs[0].name, this.props.data) ? 'number' : 'category';return (<div className="cv-graph-container"><ResponsiveContainer width="99%" height="95%"><LineChart data={this.props.data} margin={{top: 20, right: 50, left: 20, bottom: 5}}><XAxis dataKey={this.props.identPropName} domain={[minX, maxX]} label={xAxisLabel} type={xType}/><YAxis domain={[minY, maxY]} label={yAxisLabel} allowDecimals={true} type={yType}/><CartesianGrid strokeDasharray="3 3"/><Tooltip/><Legend />{graphDef.dataPointDefs.map((dataPointDef:GraphDataPointDef, i:number)=>{const color = this.colorForDataPointDef(dataPointDef, i);const legendKey = dataPointDef.legendKey || dataPointDef.name;return <Line key={i} type="monotone" dataKey={dataPointDef.name} name={legendKey}dot={true} activeDot={true} stroke={color}/>})}</LineChart></ResponsiveContainer></div>);},})
Cv
Pie
Chart
Cv
Pie
Chart
:
ClassicComponentClass
<
CvPieChartProps
>
= React.createClass<CvPieChartProps, {}>({mixins: [CvChart],render: function () {const graphDef = this.props.graphContext.graphDef;//note: to support multiple 'pie levels' the data set has to be broken in corresponding discrete sets//for now, we're taking the first dataPointDef onlyconst dataPointDef = graphDef.dataPointDefs[0];if(dataPointDef) {const legendKey = dataPointDef.legendKey || dataPointDef.name;return (<div className="cv-graph-container"><ResponsiveContainer width="99%" height="95%"><PieChart margin={{top: 20, right: 50, left: 20, bottom: 5}} onClick={(data)=>{this.handleClick(data.payload.id)}}><Tooltip cursor={{strokeDasharray: '3 3'}}/><Legend/><Pie data={this.props.data} fill={this.colorForDataPointDef(dataPointDef, 0)}nameKey={this.props.identPropName} valueKey={dataPointDef.name} label={true}/></PieChart></ResponsiveContainer></div>);} else {return null;}}})
Cv
Scatter
Chart
Cv
Scatter
Chart
:
ClassicComponentClass
<
CvScatterChartProps
>
= React.createClass<CvScatterChartProps, {}>({mixins: [CvChart],render: function () {const graphDef = this.props.graphContext.graphDef;const {minX, maxX, minY, maxY, xAxisLabel, yAxisLabel} = this.getMetaValues(graphDef, this.props.data);//note: to support multiple 'scatter series' the data set has to be broken in corresponding discrete sets//for now, we're taking the first dataPointDef onlyconst dataPointDef = graphDef.dataPointDefs[0];const xType = this.isNumeric(this.props.graphContext, dataPointDef.xAxisName, this.props.data) ? 'numeric' : 'category';const yType = this.isNumeric(this.props.graphContext, dataPointDef.name, this.props.data) ? 'numeric' : 'category';if(dataPointDef) {const legendKey = dataPointDef.legendKey || dataPointDef.name;return (<div className="cv-graph-container"><ResponsiveContainer width="99%" height="95%"><ScatterChart margin={{top: 20, right: 50, left: 20, bottom: 5}}><XAxis dataKey={dataPointDef.xAxisName} name={dataPointDef.xAxisName} domain={[minX, maxX]} label={xAxisLabel} /><YAxis dataKey={dataPointDef.name} name={legendKey} domain={[minY, maxY]} label={yAxisLabel} />{(()=>{if(this.props.bubble) {if(dataPointDef.bubbleRadiusName) {return <ZAxis dataKey={dataPointDef.bubbleRadiusName} name={dataPointDef.bubbleRadiusName} range={[10000, 50000]}/>} else {return <ZAxis dataKey={dataPointDef.bubbleRadiusName} name={dataPointDef.bubbleRadiusName} range={[10000, 10000]}/>}} else {return <ZAxis/>}})()}<CartesianGrid/><Tooltip cursor={{strokeDasharray: '3 3'}}/><Legend/><Scatter data={this.props.data} fill={this.colorForDataPointDef(dataPointDef, 0)} onClick={(data)=>{}}/></ScatterChart></ResponsiveContainer></div>);} else {return null;}}})
Object literals
Cv
Chart
Cv
Chart
:
object
_calculate
Max
_calculate
Max
(
)
:
string
Returns
string
_calculate
Min
_calculate
Min
(
)
:
number
Returns
number
_get
Sample
Value
_get
Sample
Value
(
data
:
Array
<
any
>
, name
:
string
)
:
any
Parameters
data:
Array
<
any
>
name:
string
Returns
any
color
For
Data
Point
Def
color
For
Data
Point
Def
(
dataPointDef
:
GraphDataPointDef
, i
:
number
)
:
any
Parameters
dataPointDef:
GraphDataPointDef
i:
number
Returns
any
get
Meta
Values
get
Meta
Values
(
graphDef
:
GraphDef
, data
:
Array
<
any
>
)
:
object
Parameters
graphDef:
GraphDef
data:
Array
<
any
>
Returns
object
maxX
:
any
maxY
:
any
minX
:
any
minY
:
any
x
Axis
Label
:
string
y
Axis
Label
:
string
handle
Click
handle
Click
(
id
:
any
)
:
void
Parameters
id:
any
Returns
void
is
Numeric
is
Numeric
(
graphContext
:
GraphContext
, propName
:
string
, data
:
Array
<
any
>
)
:
boolean
Parameters
graphContext:
GraphContext
propName:
string
data:
Array
<
any
>
Returns
boolean
Globals
"ext/
CvGraph
Panel"
Cv
Bar
Chart
Props
Cv
Chart
Props
Cv
Graph
Panel
Props
Cv
Graph
Panel
State
Cv
Graph
Props
Cv
Graph
State
Cv
Pie
Chart
Props
Cv
Scatter
Chart
Props
CV_
GRAPH_
DEFAULT_
COLORS
Cv
Bar
Chart
Cv
Graph
Cv
Graph
Panel
Cv
Line
Chart
Cv
Pie
Chart
Cv
Scatter
Chart
Cv
Chart
Generated using
TypeDoc