This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var data =[64, 62, 63, 59, 60, 57]; | |
| var linear = d3.scale.linear() | |
| .domain([50, 70]) | |
| .range([1, 50]); | |
| for(var i=0; i<data.length; i++) | |
| console.log(linear(data[i])); //==> 35.3,30.4,32.85,23.05,25.5,18.15 | |
| Dmin = 50; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var duration = 0; | |
| var result = ''; | |
| $('#tableData tr').slice(10, 13).find(':contains("00:")').each((index, element) => { | |
| var time = $(element).text() | |
| var minutes = time.split(':')[1] | |
| var seconds = time.split(':')[2] | |
| duration = duration + parseInt(minutes) * 60 + parseInt(seconds) | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function(a, b) { | |
| return _.omitBy(a, (value, key) => { | |
| var obj = {}; | |
| obj[key] = value; | |
| return _.isEqual(obj, b) | |
| }) | |
| } | |
| (a, b) => _.omitBy(a, (value, key) => _.isEqual({[key]: value}, b)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var data = [0,1,2,3,4,5]; | |
| var margin = {top: 10, left: 0, bottom: 10, right: 0}; | |
| var height = 200; | |
| var width = 500; | |
| var xScale = d3.scale.linear(); | |
| var yScale = d3.scale.linear(); | |
| var borderRadiusX = 20; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { EditorState } from 'draft-js'; | |
| import Editor from 'draft-js-plugins-editor'; | |
| import createMentionPlugin, { defaultSuggestionsFilter } from 'draft-js-mention-plugin'; | |
| import editorStyles from './editorStyles.css'; | |
| import 'draft-js-mention-plugin/lib/plugin.css'; | |
| const mentions = [ | |
| { | |
| name: 'Matthew Russell', | |
| link: 'https://twitter.com/mrussell247', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| d3.timeFormatDefaultLocale({ | |
| 'dateTime': '%A, %e %B %Y г. %X', | |
| 'date': '%d.%m.%Y', | |
| 'time': '%H:%M:%S', | |
| 'periods': ['AM', 'PM'], | |
| 'days': ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота'], | |
| 'shortDays': ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], | |
| 'months': ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'], | |
| 'shortMonths': ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'] | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function draw(data) { | |
| const margin = { top: 20, right: 20, bottom: 50, left: 50 }; | |
| const width = 920 - margin.left - margin.right; | |
| const height = 390 - margin.top - margin.bottom; | |
| const x = d3.scaleTime() | |
| .range([0, width]); | |
| const y = d3.scaleLinear() | |
| .range([height, 0]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data.forEach(d => { | |
| d.date = new Date(d.date); | |
| d.percent = +d.percent; | |
| }); | |
| x.domain(d3.extent(data, d => d.date)); | |
| y.domain([0, d3.max(data, d => d.percent)]); | |
| colorScale.domain(d3.map(data, d => d.regionId).keys()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const xAxis = d3.axisBottom(x) | |
| .ticks((width + 2) / (height + 2) * 5) | |
| .tickSize(-height - 6) | |
| .tickPadding(10); | |
| const yAxis = d3.axisRight(y) | |
| .ticks(5) | |
| .tickSize(7 + width) | |
| .tickPadding(-15 - width) | |
| .tickFormat(d => d + '%'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const nestByRegionId = d3.nest() | |
| .key(d => d.regionId) | |
| .sortKeys((v1, v2) => (parseInt(v1, 10) > parseInt(v2, 10) ? 1 : -1)) | |
| .entries(data); | |
| const regions = {}; | |
| d3.map(data, d => d.regionId) | |
| .keys() | |
| .forEach((d, i) => { |
OlderNewer