1. fixed hover issue
2. search is case insensitive on tables 3. text aligned leftmaster
parent
73c30d7f8e
commit
0dcad337ed
|
|
@ -2,11 +2,7 @@
|
||||||
"tabList": [{
|
"tabList": [{
|
||||||
"tabTitle": "Tab 1",
|
"tabTitle": "Tab 1",
|
||||||
"fileName": "data.csv",
|
"fileName": "data.csv",
|
||||||
"colorColumn": "status",
|
"colorColumn": "status"
|
||||||
"colorMap" : {
|
|
||||||
"complicated":"red",
|
|
||||||
"single":"green"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tabTitle": "Tab 2",
|
"tabTitle": "Tab 2",
|
||||||
|
|
@ -28,7 +24,11 @@
|
||||||
"chartList":[{
|
"chartList":[{
|
||||||
"fileName": "data.csv",
|
"fileName": "data.csv",
|
||||||
"chartColumn": "status"
|
"chartColumn": "status"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"fileName": "data.csv",
|
||||||
|
"chartColumn": "age"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"colorMaps" : {
|
"colorMaps" : {
|
||||||
"status" : {
|
"status" : {
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import {
|
||||||
} from 'recharts';
|
} from 'recharts';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { Container, Title } from 'bloomer';
|
import { Title } from 'bloomer';
|
||||||
// const randomColor = require('randomcolor');
|
const randomColor = require('randomcolor');
|
||||||
import * as Papa from 'papaparse';
|
import * as Papa from 'papaparse';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -49,15 +49,18 @@ export class Chart extends React.Component<any, any> {
|
||||||
// );
|
// );
|
||||||
// };
|
// };
|
||||||
const colorMap = this.props.colorMap;
|
const colorMap = this.props.colorMap;
|
||||||
|
// const LabeText = (props: any) => {
|
||||||
|
// return (<text>{props.name}</text>);
|
||||||
|
// };
|
||||||
return (
|
return (
|
||||||
<Container>
|
<div>
|
||||||
<Title isSize={4}>Plotting {_.capitalize(this.props.chartColumn)}</Title>
|
<Title isSize={4}>{_.capitalize(this.props.chartColumn)}</Title>
|
||||||
<ResponsiveContainer width="100%" height={200}>
|
<ResponsiveContainer width="100%" height={500}>
|
||||||
<PieChart>
|
<PieChart>
|
||||||
<Pie data={chartData} dataKey='value' outerRadius={100} label={true} labelLine={false}>
|
<Pie data={chartData} dataKey='value' outerRadius={100} labelLine={true} label={true}>
|
||||||
{
|
{
|
||||||
chartData.map((_0, _1) => {
|
chartData.map((_0, _1) => {
|
||||||
const color = _.get(colorMap, _0.name, 'gray');
|
const color = _.get(colorMap, _0.name, randomColor());
|
||||||
return (<Cell key={_1} fill={color} />)
|
return (<Cell key={_1} fill={color} />)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +68,7 @@ export class Chart extends React.Component<any, any> {
|
||||||
<Tooltip />
|
<Tooltip />
|
||||||
</PieChart>
|
</PieChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
</Container>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,7 @@ export default class ChartLoader extends React.Component<any, any> {
|
||||||
<Chart csvFile={o.fileName} chartColumn={o.chartColumn} colorMap={colorMap} />
|
<Chart csvFile={o.fileName} chartColumn={o.chartColumn} colorMap={colorMap} />
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
}
|
})}
|
||||||
|
|
||||||
)}
|
|
||||||
</Columns>
|
</Columns>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ export default class ServerTable extends React.Component<any, any> {
|
||||||
const data = this.state.data;
|
const data = this.state.data;
|
||||||
const headers = this.state.headers;
|
const headers = this.state.headers;
|
||||||
const filterPart = (filter: any, row: any) =>
|
const filterPart = (filter: any, row: any) =>
|
||||||
String(row[filter.id]).startsWith(filter.value) ||
|
String(_.toLower(row[filter.id])).startsWith(_.toLower(filter.value)) ||
|
||||||
String(row[filter.id]).endsWith(filter.value)
|
String(_.toLower(row[filter.id])).endsWith(_.toLower(filter.value))
|
||||||
const headerGen = (headerName: string) => {
|
const headerGen = (headerName: string) => {
|
||||||
// const title = headerName
|
// const title = headerName
|
||||||
// .replace(/([A-Z])/g, ' $1')
|
// .replace(/([A-Z])/g, ' $1')
|
||||||
|
|
@ -68,6 +68,11 @@ export default class ServerTable extends React.Component<any, any> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
const colStyle = () => ({
|
||||||
|
style: {
|
||||||
|
textAlign: 'left'
|
||||||
|
}
|
||||||
|
});
|
||||||
const headerCols = headers.map(headerGen);
|
const headerCols = headers.map(headerGen);
|
||||||
return (
|
return (
|
||||||
<ReactTable
|
<ReactTable
|
||||||
|
|
@ -79,6 +84,7 @@ export default class ServerTable extends React.Component<any, any> {
|
||||||
defaultPageSize={100}
|
defaultPageSize={100}
|
||||||
className="-striped -highlight"
|
className="-striped -highlight"
|
||||||
getTrProps={rowStyle}
|
getTrProps={rowStyle}
|
||||||
|
getTdProps={colStyle}
|
||||||
style={{
|
style={{
|
||||||
height: "75vh"
|
height: "75vh"
|
||||||
}}
|
}}
|
||||||
|
|
@ -88,7 +94,6 @@ export default class ServerTable extends React.Component<any, any> {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{makeTable()}
|
{makeTable()}
|
||||||
{/* <Chart data={lastFiltered} /> */}
|
|
||||||
<Button>
|
<Button>
|
||||||
<CSVLink data={lastFiltered} filename={"data.csv"}>
|
<CSVLink data={lastFiltered} filename={"data.csv"}>
|
||||||
Download CSV
|
Download CSV
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue