Skip to content

Instantly share code, notes, and snippets.

@skokenes
skokenes / index.js
Created September 26, 2019 14:25
SVG Path Generator for Rounded Rectangles
function createRoundedRectPath(x, y, width, height, radius) {
return (
// Move to position, offset by radius in x direction
"M" +(x + radius) + "," + y
// Draw a horizontal line to the top right curve start
+ "h" + (width - 2 * radius)
// Draw the top right corner curve
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
// Draw a vertical line to the bottom right corner
+ "v" + (height - 2 * radius)
@skokenes
skokenes / d3-lasso.min.js
Last active November 5, 2020 07:44
d3.lasso example - scatterplot
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-drag")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-drag"],n):n(t.d3=t.d3||{},t.d3,t.d3)}(this,function(t,n,r){"use strict";function e(t,n){return n={exports:{}},t(n,n.exports),n.exports}function o(){function t(t){function u(){p=[],h="",_.attr("d",null),m.attr("d",null),r.nodes().forEach(function(t){t.__lasso.possible=!1,t.__lasso.selected=!1,t.__lasso.hoverSelect=!1,t.__lasso.loopSelect=!1;var n=t.getBoundingClientRect();t.__lasso.lassoPoint=[Math.round(n.left+n.width/2),Math.round(n.top+n.height/2)]}),s&&r.on("mouseover.lasso",function(){this.__lasso.hoverSelect=!0}),i.start()}function l(){var t,n;"touchmove"===d3.event.sourceEvent.type?(t=d3.event.sourceEvent.touches[0].clientX,n=d3.event.sourceEvent.touches[0].clientY):(t=d3.event.sourceEvent.clientX,n=d3.event.sourceEvent.clientY);var s=d3.mouse(this)[0],u=d3.mouse(this)[1];""===h?(h=h+"M "+s+" "+u,v=[t,n],d=[s,
@skokenes
skokenes / docker-compose.yml
Created April 7, 2020 15:36
Qlik Core Bug Example: crashing when empty dimension added to hypercube
version: "3.5"
services:
qix-test:
container_name: "qix-test"
image: qlikcore/engine:12.612.0
command: -S AcceptEULA=yes -S SystemLogVerbosity=3 -S DocumentDirectory=/data
volumes:
- ./data:/data
ports:
- 9077:9076
@skokenes
skokenes / README.md
Last active April 22, 2019 13:12
Scatterplot with Lasso

This example demonstrates incorporating the d3 lasso plugin with a d3 scatterplot. Clicking and dragging on the plot area will produce a lasso that can be used to hover or loop around the dots in the scatterplot. Functions are then executed based on whether dots were selected or not.

The lasso plugin can be found here.

@skokenes
skokenes / d3formatting.css
Created March 29, 2019 22:51 — forked from zanarmstrong/d3formatting.css
formatting numbers example
body {
margin: 20px 0px 0px 50px;
}
.formattext {
text-align: right;
}
.formatresult {
text-align: left;
@skokenes
skokenes / App.js
Created November 1, 2018 14:58
Using context and hooks to serve RxQ Handles
import React from "react";
import QaeProvider from "./qae/qae-provider";
export default () => {
<div className="App">
<QaeProvider>
{/* any children in here can read from the context */}
</QaeProvider>
</div>
}
@skokenes
skokenes / load.js
Created August 21, 2018 20:24
Loading a CSV with Qlik Core
const { connectSession } = require("rxq");
const { concat } = require("rxjs");
const { switchMap, shareReplay, take, tap } = require("rxjs/operators");
const config = {
host: "localhost",
port: 19076
};
// Engine Session
@skokenes
skokenes / sorted-dimension-hypercube.json
Created August 16, 2018 14:53
Sort a Dimension in a HyperCube
{
"qDimensions": [
{
"qDef": {
"qFieldDefs": ["AR Date Group Description"],
"qSortCriterias": [
{
"qSortByAscii": 1
}
]
@skokenes
skokenes / null-suppression-hypercube.json
Created August 16, 2018 14:48
HyperCube with Null Suppression
{
"qDimensions": [
{
"qDef": { "qFieldDefs": ["AR Date Group Description"]},
"qNullSuppression": true
}
],
"qMeasures": [
{
"qDef": { "qDef": "sum({<[MonthIndex]={[$(=Max(MonthIndex))]}>} [AR Net Balance])" }
@skokenes
skokenes / basic-hypercube.json
Created August 16, 2018 14:48
Basic Hypercube Def
{
"qDimensions": [
{
"qDef": { "qFieldDefs": ["AR Date Group Description"]}
}
],
"qMeasures": [
{
"qDef": { "qDef": "sum({<[MonthIndex]={[$(=Max(MonthIndex))]}>} [AR Net Balance])" }
}