Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function prepareCharts(jobs, start, end, firstRun) {
if (firstRun) //if its the first run expect everything to not exist, and draw it all
{
facts = crossfilter(jobs.Results)
var all = facts.groupAll();
//display totals
countchart = dc.dataCount(".total");
// jobs per hour time chart
timeOpenChart = dc.barChart("#dc-timeopen-chart");
runningChart = dc.compositeChart("#dc-running-chart");
timeClosedChart = dc.barChart("#dc-timeclosed-chart");
dataTable = dc.dataTable("#dc-table-graph");
completionBellChart = dc.barChart("#dc-completionbell-chart");
var closeTimeDimension = facts.dimension(function(d) {
return d.JobCompleted;
});
var timeOpenDimension = facts.dimension(function(d) {
renderDC = (selectedTimespan) => {
const { formatMessage } = this.props.intl;
// show a spinner while it loads
this.showLoading(true);
// set up chart containers
const storiesOverTimeChart = dc.barChart('#stories-over-time-chart');
const storyCount = dc.dataCount('#story-counts');
const languageChart = dc.pieChart('#language-chart');
const TopicStoryTable = dc.dataTable('#story-table');
const facebookShareChart = dc.barChart('#facebook-share-chart');
const inlinkChart = dc.barChart('#inlink-chart');
// load the data up
d3.csv(this.csvFileUrl(), (data) => {
this.showLoading(false);
// set up some binning
const maxFacebookShares = d3.max(data.map(d => d.facebook_share_count));
const facebookBinSize = maxFacebookShares / FACEBOOK_BIN_COUNT;
const maxInlinks = d3.max(data.map(d => d.media_inlink_count));
const inlinkBinSize = d3.max([1, (maxInlinks / INLINK_BIN_COUNT)]); // don't do < 1 for bin size
// clean up the data
for (let i = 0; i < data.length; i += 1) {
const d = data[i];
d.publishDate = (d.publish_date === STORY_PUB_DATE_UNDATEABLE) ? null : storyPubDateToMoment(d.publish_date).toDate();
// Get MIN and MAX response time values
const minResponseTime = d3.min(items, (d) => { return d.fields.response_time[0]; });
// Create dimension based on response time
const responseTimeDimension = index.dimension((d) => { return d.fields.response_time[0]; });
// Create response time group
const responseTimeGroup = responseTimeDimension.group((d) => {
return binwidth * Math.floor(d / binwidth);
});
// Group add dimensions
const all = index.groupAll();
// Keep data counters on a dashboard updated
dc.dataCount('#row-selection')
.dimension(index)
.group(all);
// Get MIN and MAX timestamp values
const minDate = d3.min(items, (d) => { return d.fields.ymd; });
const maxDate = d3.max(items, (d) => { return d.fields.ymd; });
// Init scales for axis
const timeScaleForLineChart = d3.time.scale().domain([minDate, maxDate]);
const timeScaleForRangeChart = d3.time.scale().domain([minDate, maxDate]);
const xScaleForBar = d3.scale.pow().domain([minResponseTime, 1000]);
return {
timeStampDimension,
timeStampGroup,
statusCodeDimension,
componentDidMount(){
console.log("here!!!");
var danmu_lineChart = dc.lineChart('#danmu-line-chart');
var danmu_barChart = dc.barChart('#danmu-volume-chart');
var danmu_Table = dc.dataTable('.dc-data-table');
var danmu_Count = dc.dataCount('.dc-data-count');
var colorChart = dc.pieChart('#color-chart');
var posChart = dc.pieChart('#pos-chart');
var charNumChart = dc.pieChart('#char-chart');
var danmu_up_barChart = dc.barChart('#danmu-up-chart');
let {csv_data,video_up_time, video_len} = this.props;
var data = [];
var time_cut = 100;
//图标宽度
var row_width = $("div.bootstrap-custom").width() * 10 /12;
console.log(row_width, 55);
row_width = row_width> 0 ? row_width: 400;
var up_time_cut = 100;
$(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;
});
d3.json(parent.attr("data-url"), function (resp) {