Skip to content

Instantly share code, notes, and snippets.

@tripp
tripp / candlestickseries.js
Created January 16, 2014 21:29
candlestickseries.js
YUI({
defaultGraphicEngine: (window.location.search.match(/[?&]defaultGraphicEngine=([^&]+)/) || [])[1] || 'svg',
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw'
}).use('axis-numeric-base', 'axis-category-base', 'series-candlestick', function (Y)
{
var myDataValues = [
{date:"5/1/2010", open:2000, high:3700, low:200, close: 2300},
{date:"5/2/2010", open:1500, high:9100, low:100, close: 500},
{date:"5/3/2010", open:400, high:3100, low:1500, close: 2000},
{date:"5/4/2010", open:3200, high:3900, low:2800, close: 2900},
@tripp
tripp / yuichartsissue1475.js
Created December 9, 2013 17:49
yuichartsissue1475.js
var histogramDrawSeries = function() {
if(this.get("xcoords").length < 1)
{
return;
}
var style = this._copyObject(this.get("styles").marker),
graphic = this.get("graphic"),
setSize,
calculatedSize,
xcoords = this.get("xcoords"),
@tripp
tripp / donutchart.js
Last active December 28, 2015 05:59
donutchart.js
var myDataValues = [
{day:"Monday", taxes:2000},
{day:"Tuesday", taxes:50},
{day:"Wednesday", taxes:4000},
{day:"Thursday", taxes:200},
{day:"Friday", taxes:2000}
],
getDonutChart = function(cfg)
{
var pieGraph = new Y.Chart(cfg),
@tripp
tripp / charts-interactive-annotations
Created October 1, 2013 00:55
charts-interactive-annotations
YUI.add('charts-interactive-annotations', function (Y) {
/**
* Allows for the creation of annotations for a chart.
*
* @module charts-interactive-annotations
*/
/**
* Creates a marker that can be used as an annotation.
*
* @class AnnotationMarker
@tripp
tripp / iedasharrayworkaround.js
Created August 19, 2013 21:47
iedasharrayworkaround.js
YUI({filter: 'raw'}).use('graphics', function (Y)
{
var dashArray = [4, 2],
drawDashedLine = function(path, xStart, yStart, xEnd, yEnd, dashSize, gapSize)
{
dashSize = dashSize || 10;
gapSize = gapSize || 10;
var segmentLength = dashSize + gapSize,
xDelta = xEnd - xStart,
yDelta = yEnd - yStart,
@tripp
tripp / iedasharraypatch.js
Created August 19, 2013 21:42
iedasharraypatch.js
if(Y.VMLShape) {
Y.Shape.prototype._getStrokeProps = function()
{
var props,
stroke = this.get("stroke"),
strokeOpacity,
dashstyle,
dash = "",
val,
i = 0,
@tripp
tripp / dualaxeswithgridlines.html
Created July 24, 2013 00:05
dualaxeswithgridlines.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Dual Axes Chart</title>
<style type="text/css">
#mychart {
width: 700px;
height: 350px;
}
@tripp
tripp / drawLegendPatch.js
Last active December 19, 2015 14:38
drawLegendPatch.js
Y.ChartLegend.prototype._drawLegend = function()
{
var chart = this.get("chart"),
node,
seriesCollection = chart.get("seriesCollection"),
series,
styles,
padding,
itemStyles,
seriesStyles,
@tripp
tripp / ie8rotationissue.js
Created June 27, 2013 15:02
IE 8 Axis Label Rotation.
//Unable to parse
//var data =[{"records":"[{\"category\":\"doc4\",\"value\":1},{\"category\":\"heute rating dokument2\",\"value\":2},{\"category\":\"rating Dokument1\",\"value\":1}]","singleChartAxes":"{\"yAxesTitle\":\"Bewertung3_single\",\"maxNumberOfCounts\":2}","ratingTooltip":"{\"ratingTooltip\":\"merci\"}"}];
//manually converterted into vars
var jsonValues = [{"category":"doc4","value":1},{"category":"heute rating dokument2","value":2},{"category":"rating Dokument1","value":1}],
chartAxesObject = {"yAxesTitle":"Bewertung3_single","maxNumberOfCounts":2},
jsonRatingTooltip = {ratingTooltip:"merci"};
//Chart Legend
var myLegend = {
@tripp
tripp / legendredrawpatch.js
Created June 26, 2013 21:05
Temporary hack addressing issue in which a legend tries to redraw without available data.
Y.CartesianChart.prototype._dataProviderChangeHandler = function(e) {
var dataProvider = e.newVal,
axes,
i,
axis;
this._seriesIndex = -1;
this._itemIndex = -1;
this._drawing = true;
if(this instanceof Y.CartesianChart)
{