Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
d3.json("data/yelp_test_set_business.json", (yelp_data:IYelpData[]) => {
/********************************************************
* *
* Step1: Create the dc.js chart objects & ling to div *
* *
********************************************************/
var bubbleChart: dc.BubbleChart = dc.bubbleChart("#dc-bubble-graph");
var pieChart: dc.PieChart = dc.pieChart("#dc-pie-graph");
var volumeChart: dc.BarChart = dc.barChart("#dc-volume-chart");
var lineChart: dc.LineChart = dc.lineChart("#dc-line-chart");
var dataTable: dc.DataTableWidget = dc.dataTable("#dc-table-graph");
var rowChart: dc.RowChart = dc.rowChart("#dc-row-graph");
/********************************************************
* *
* Step2: Run data through crossfilter *
* *
********************************************************/
var ndx: CrossFilter.CrossFilter = crossfilter(yelp_data);
/********************************************************
* *
* Step3: Create Dimension that we'll need *
* *
********************************************************/
// for volumechart
var cityDimension: CrossFilter.Dimension = ndx.dimension((d: IYelpData) => d.city);
timeStampDimension,
timeStampGroup,
statusCodeDimension,
statusCodeGroup,
responseTimeDimension,
responseTimeGroup,
timeScaleForLineChart,
timeScaleForRangeChart,
xScaleForBar,
binwidth,
} = parsedData;
// Init charts
const requestsOverTime = dc.lineChart('#requestsOverTime-chart');
const overviewChart = dc.barChart('#overviewChart-chart');
const statusCodeCounts = dc.rowChart('#statusCodeCounts-chart');
const responseTimeDistribution = dc.barChart('#responseTimeDistribution-chart');
requestsOverTime
.height(350)
.renderArea(true)
.transitionDuration(300)
.margins({ top: 5, right: 20, bottom: 25, left: 40 })
.ordinalColors(['#2fa4e7'])
.x(timeScaleForLineChart)
.dimension(timeStampDimension)
.group(timeStampGroup)
.rangeChart(overviewChart)
.brushOn(false)
.renderHorizontalGridLines(true)
.renderVerticalGridLines(true)
.elasticY(true);
componentDidMount(){
this.chart = dc.rowChart(this.chart)
this.configure()
this.chart.render()
}
}
$(function () {
var dateFormat = d3.time.format('%Y-%m-%d');
var parent = d3.select('[data-chart="transactions-overview"]');
//todo custom reduce functions for server-side stuff
var volumeChart = dc.barChart('#volume-chart');
var valueChart = dc.compositeChart('#value-chart');
var amountChart = dc.barChart(valueChart);
var cumAmountChart = dc.lineChart(valueChart);
var accountChart = dc.rowChart('#account-selector');
var typeChart = dc.rowChart('#account-type-selector');
var transactionTable = dc.dataTable('#transaction-table');
var transactionCount = dc.dataCount(".dc-data-count");
var params = (new URL(document.location)).searchParams;
var dateMin = dateFormat.parse(params.get('after'));
var dateMax = dateFormat.parse(params.get('before'));
$("#reset-all").click(function () {
dc.filterAll();
dc.renderAll();
return false;
});
$("#reset-volume-chart").click(function () {
volumeChart.filterAll();
dc.redrawAll();
return false;
$(function () {
var dateFormat = d3.time.format('%Y-%m-%d');
var parent = d3.select('[data-chart="transactions-overview"]');
//todo custom reduce functions for server-side stuff
var volumeChart = dc.barChart('#volume-chart');
var valueChart = dc.compositeChart('#value-chart');
var amountChart = dc.barChart(valueChart);
var cumAmountChart = dc.lineChart(valueChart);
var accountChart = dc.rowChart('#account-selector');
var typeChart = dc.rowChart('#account-type-selector');
var transactionTable = dc.dataTable('#transaction-table');
var transactionCount = dc.dataCount(".dc-data-count");
var params = (new URL(document.location)).searchParams;
var dateMin = dateFormat.parse(params.get('after'));
var dateMax = dateFormat.parse(params.get('before'));
$("#reset-all").click(function () {
dc.filterAll();
dc.renderAll();
return false;
});
$("#reset-volume-chart").click(function () {
volumeChart.filterAll();
dc.redrawAll();
return false;
});