Skip to content

Instantly share code, notes, and snippets.

View gallirohik's full-sized avatar

Rohik Galli gallirohik

View GitHub Profile
@gallirohik
gallirohik / lineChart.jsx
Created January 31, 2019 18:53
Dashboard project charts with react-chartjs-2
import React from "react";
import {Line} from 'react-chartjs-2'
function LineChart(props){
const count = props.chartData.map( data => data.count)
const labels = props.chartData.map( data => data.year+'/'+data.quarter)
const chartData = {
labels:labels,
datasets:[
{
label:'Population',
@gallirohik
gallirohik / lineChart.jsx
Created January 30, 2019 13:11
Dashboard project
import React from "react";
import {
XYPlot,
XAxis,
YAxis,
VerticalGridLines,
HorizontalGridLines,
LineSeries
} from "react-vis";
function LineChart(props) {
@gallirohik
gallirohik / dataGrid.jsx
Created January 30, 2019 13:10
Dashboard project
import React from "react";
import { AgGridReact } from "ag-grid-react";
import "ag-grid-community/dist/styles/ag-grid.css";
import "ag-grid-community/dist/styles/ag-theme-balham.css";
function DataGrid(props) {
function getSelectedRows() {
console.log("getSelected");
}
return (
<React.Fragment>
@gallirohik
gallirohik / footer.jsx
Created January 30, 2019 13:10
Dashboard Project
@gallirohik
gallirohik / mainContent.jsx
Created January 30, 2019 13:09
Dashboard project
import React, { Component } from "react";
import DataGrid from "./dataGrid";
import LineChart from "./charts/LineChart";
class MainContent extends Component {
constructor() {
super();
this.state = {
columnDefs: [
{
headerName: "Name",
@gallirohik
gallirohik / header.jsx
Created January 30, 2019 13:08
Dashboard project
import React from "react";
function Header(props) {
return (
<React.Fragment>
<h1>
Statistics with amounts of pull-requests per programming language on
Github
</h1>
</React.Fragment>
);
@gallirohik
gallirohik / App.css
Created January 30, 2019 13:08
Dashboard project
.main-container {
display: flex;
}
.main-container > .data-grid {
flex: 1;
}
.main-container > .data-chart {
flex: 2;
}
@gallirohik
gallirohik / index.js
Created January 30, 2019 13:07
Dashboard project
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
ReactDOM.render(<App />, document.getElementById("root"));
serviceWorker.unregister();
@gallirohik
gallirohik / App.js
Last active January 30, 2019 18:39
Dash board Project
import React, { Component } from "react";
import "./App.css";
import Header from "./components/header";
import MainContent from "./components/mainContent";
import Footer from "./components/footer";
class App extends Component {
render() {
return (
<React.Fragment>
<Header />
@gallirohik
gallirohik / activity.cpp
Created August 30, 2018 06:56
Activity selection problem using Greedy approach
#include<iostream>
#include<utility>
#include<vector>
#include<algorithm>
using namespace std;
bool myfun(pair<int,int> a ,pair<int,int> b)
{
return a.second < b.second;
}
void getActivities(vector< pair<int,int> > a)