Skip to content

Instantly share code, notes, and snippets.

View NishiBangar's full-sized avatar

Nishchith J Bangar NishiBangar

View GitHub Profile
@NishiBangar
NishiBangar / chartjs_lineGraph.js
Created May 18, 2022 00:54
ChartJs- Basic Line graph implementation
// Working implementation - https://codepen.io/NishiBangar/pen/YzVoQYw
<!-- HTML code -->
<canvas id="myChart" width="400" height="100"></canvas>
var ctx = document.getElementById("myChart").getContext("2d");
const colors = {
@NishiBangar
NishiBangar / Charjs-StackedAreaGraph.js
Last active May 18, 2022 00:40
ChartJs implementation to demonstrate Stacked Area Graph data representation, categorised by date
// Working code https://codepen.io/NishiBangar/pen/gORbmrp
<!-- HTML CODE -->
<canvas id="myChart" width="400" height="100"></canvas>
// Angular code
const colors = {
green: {
fill: 'rgb(0,128,0,0.2)',
@NishiBangar
NishiBangar / stackedAeaGraph.js
Last active May 18, 2022 00:30
CanvasJs - StackedArea Graph (x-axis --> Date and y-axis --> Number count)
<!-- Html Stacked Area Graph -->
<div class="container-fluid" >
<div class="row">
<div class="col-md-12">
<div id="chartContainer" style="height: 300px; width: 100%;">
</div>
</div>
</div>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
@NishiBangar
NishiBangar / angular_currency_format_directive.js
Last active May 17, 2022 23:54
Angular directive to format numeric values. Trasform numbers in thousands with "K" and in millions to "M" ( 1000-990000 --> K and 1000000 >= ---> M )
// HTML
<!-- Directive to Format value to ( Charges CurrencyType ) -->
<format-transaction format-type = "charges" currency-type = "{{currencyType}}" transaction-charge = "{{transactionCharge}}" transaction-limit = "" transaction-period = "" extra-transactions = "" extra-transaction-charge="">
</format-transaction>
// Angular Controller
app.directive('formatTransaction', function() {
@NishiBangar
NishiBangar / angular_date_subtraction.js
Created July 26, 2021 05:28
Subtract two dates - Angular - [15 days - 1 Month - 2 Months]
// Set time-period combo option
$scope.timePeriodOptions = [
{ option: "Last 15 days", model: "15Days" },
{ option: "Last 1 month", model: "1Month" },
{ option: "Last 2 months", model: "2Month" }
];
$scope.timePeriod= { startDate: "", endDate: "" };
if(timePeriod.model == "15Days" ){
$scope.startDate = new Date(new Date().setDate(new Date().getDate() -15 ));
@NishiBangar
NishiBangar / Multiplication-of-digits-based-on-column-counts.markdown
Last active June 20, 2017 15:18
Multiplication of Digits based on column counts

Multiplication of Digits based on column counts

Multiplication of digits, such a way that, first column should include "Numbers in Ascending order" and the next should include "Number in Descending order". This pattern should be followed for the number of column counts.

Example : Count=2; 1 * 10 = 10 2 * 9 = 18 3 * 8 = 24 . . . . . . .

@NishiBangar
NishiBangar / Print-array-elements-in-grid-format-using-multiple-ng-repeat.markdown
Last active April 12, 2017 08:48
Print array elements in grid format using multiple "ng-repeat"
@NishiBangar
NishiBangar / Merge 2 Strings Alternatively Character-By-Character.markdown
Last active October 17, 2016 12:59
Merge 2 Strings Alternatively Character-By-Character

Merge 2 Strings Alternatively Character-By-Character

An AngularJS application that includes "MergeService" that takes care of merging 2 string alternatively character-by-character which i is received as input and producing the output as below

String1 = abc
String 2= 123
Result= a1b2c3

@NishiBangar
NishiBangar / Time-Only-directive-angularjs.markdown
Last active October 6, 2016 12:48
Time Only Directive-AngularJS

Time Only Directive-AngularJS

An AngularJs directive, that takes care of the input to accept numbers only to generate a "Time" value with the format ( hh:mm:ss ).
The separator ":" is appended after "hh" and "mm" automatically ,thus restricting the user to enter 2 digit value. (example : 23:59:59).

The directive also takes care , that the initial value is not be started with a separator(:).

The value of hour (ie : hh ) , if reached or more than "24", the model is automatically set to "23".