From: dsc Date: Thu, 23 Feb 2012 20:26:59 +0000 (-0800) Subject: Updates tag tracking. X-Git-Url: http://git.less.ly:3516/?a=commitdiff_plain;h=581ce0e389966d81388b263e8f1546fff36b613d;p=limn-bak.git Updates tag tracking. --- diff --git a/docs/notes.md b/docs/notes.md index e69de29..6a9ea45 100644 --- a/docs/notes.md +++ b/docs/notes.md @@ -0,0 +1,2 @@ +# notes + diff --git a/lib/scaffold/model.co b/lib/scaffold/model.co index a98bd41..af6a85f 100644 --- a/lib/scaffold/model.co +++ b/lib/scaffold/model.co @@ -1,19 +1,55 @@ -_ = require 'kraken/underscore' -op = require 'kraken/util/op' +_ = require 'kraken/underscore' +op = require 'kraken/util/op' +Hash = require 'hashish' ### Scaffold Models +class exports.Tags extends Array + tags : {} + + (values=[]) -> + @tags = {} + @add values if values?.length + + has: (tag) -> + @tags[tag]? + + get: (tag) -> + return -1 unless tag + unless @tags[tag]? + @tags[tag] = @length + @push tag + @tags[tag] + + update: (tags) -> + is_single = typeof tags is 'string' + tags = [tags] if is_single + indices = ( for tag of tags then @get tag ) + if is_single then indices[0] else indices + + toString: -> "Tags(length=#{@length}, values=[\"#{@join '", "'}\"])" + + +KNOWN_TAGS = exports.KNOWN_TAGS = new Tags() + Field = exports.Field = Backbone.Model.extend do # {{{ - ctorName : 'Field' + ctorName : 'Field' idAttribute : 'name' + initialize: -> @set 'value', @get('default'), {+silent} if not @has 'value' # console.log "#this.initialize!" + @on 'all', (evt) ~> console.log "#this.trigger(#evt)" + + # Notify Tag indexer of category when created, to ensure all category-tags + # get indices with colors :P + KNOWN_TAGS.update @getCategory() + # Model defaults defaults: -> { name : '' @@ -25,6 +61,41 @@ Field = exports.Field = Backbone.Model.extend do # {{{ examples : [] } + # Wrapper to ensure @set('tags') is called, as tags.push() + # will not trigger the 'changed:tags' event. + addTag: (tag) -> + return this unless tag + tags = @get('tags', []) + tags.push tag + @set 'tags', tags + this + + # Wrapper to ensure @set('tags') is called, as tags.push() + # will not trigger the 'changed:tags' event. + removeTag: (tag) -> + return this unless tag + tags = @get('tags', []) + _.remove tags, tag + @set 'tags', tags + this + + # Keep tag list up to date + onTagUpdate: -> + KNOWN_TAGS.update @get 'tags' + this + + getTagIndex: (tag) -> + KNOWN_TAGS.get tag + + # A field's category is its first tag. + getCategory: -> + @get('tags', [])[0] + + getCategoryIndex: -> + @getTagIndex @getCategory() + + + getParser: (type) -> type or= @get 'type' t = _ type.toLowerCase() @@ -44,7 +115,7 @@ Field = exports.Field = Backbone.Model.extend do # {{{ # TODO: handle 'or' by returning an array of parsers parser - + getValue: (def) -> @getParser() @get 'value', def @@ -62,6 +133,7 @@ Field = exports.Field = Backbone.Model.extend do # {{{ isDefault: -> @get('value') is @get('default') + toJSON: -> {id:@id} import do _.clone(@attributes) import { value:@getValue(), def:@get('default') } diff --git a/lib/server/server.co b/lib/server/server.co index d9a6c44..2f7ff0d 100755 --- a/lib/server/server.co +++ b/lib/server/server.co @@ -85,7 +85,7 @@ app.configure -> log_level : LOG_LEVEL app.use require('browserify') do mount : '/vendor/browserify.js' - require : <[ events seq ]> + require : <[ events seq hashish ]> # Serve static files app.use express.static WWW diff --git a/lib/template/graph-option.jade b/lib/template/graph-option.jade index 92fee6e..20494dc 100644 --- a/lib/template/graph-option.jade +++ b/lib/template/graph-option.jade @@ -1,11 +1,11 @@ include browser-helpers - var option_id = _.domize('option', id); - var value_id = _.domize('value', id); -//- - var category_cls = _.domize('category', category); +- var category_cls = _.domize('category', model.getCategoryIndex()) + ' ' + _.domize('category', model.getCategory()); - var tags_cls = tags.map(_.domize('tag')).join(' '); - var type_cls = _.domize('type', type); -.field.option(id=option_id, class="#{category} #{tags_cls}") +.field.option(id=option_id, class="#{category_cls} #{tags_cls}") a.close × h3.shortname #{_.shortname(name)} @@ -21,7 +21,7 @@ include browser-helpers //- .tags(data-toggle="collapse", data-target="##{option_id} .tags ul"): ul.collapse .tags for tag in tags - span.tag(class=_.domize('tag', tag)) #{tag} + span.tag(class=_.domize('tag', tag)+' '+_.domize('category', model.getTagIndex(tag))) #{tag} | .examples(data-toggle="collapse", data-target="##{option_id} .examples ul"): ul.collapse for example in examples diff --git a/msc/dygraph-options/data.yaml b/msc/dygraph-options/data.yaml index 7f7931d..4e3d575 100644 --- a/msc/dygraph-options/data.yaml +++ b/msc/dygraph-options/data.yaml @@ -4,7 +4,6 @@ default: 480 desc: Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored. - category: Overall display tags: - overall display @@ -13,15 +12,25 @@ default: 320 desc: Height, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored. - category: Overall display tags: - overall display +- name: file + type: String (URL of CSV or CSV), GViz DataTable or 2D Array + default: null + desc: Sets the data being displayed in the chart. This can only be set when calling updateOptions; + it cannot be set from the constructor. For a full description of valid data formats, see the Data + Formats page. + tags: + - data + examples: + - drawing + - dygraph-many-points-benchmark + - name: annotationClickHandler type: function(annotation, point, dygraph, event) default: null desc: If provided, this function is called whenever the user clicks on an annotation. - category: Annotations tags: - annotations - handler @@ -32,7 +41,6 @@ type: function(annotation, point, dygraph, event) default: null desc: If provided, this function is called whenever the user double-clicks on an annotation. - category: Annotations tags: - annotations - handler @@ -43,7 +51,6 @@ type: function(annotation, point, dygraph, event) default: null desc: If provided, this function is called whenever the user mouses out of an annotation. - category: Annotations tags: - annotations - handler @@ -54,7 +61,6 @@ type: function(annotation, point, dygraph, event) default: null desc: If provided, this function is called whenever the user mouses over an annotation. - category: Annotations tags: - annotations - handler @@ -67,7 +73,6 @@ desc: Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data series to be interpreted as annotations on points in that series. This is the same format used by Google's AnnotatedTimeLine chart. - category: Annotations tags: - annotations examples: @@ -80,7 +85,6 @@ \ of zero is disabled. \nThis is particularly useful for data sets that contain many zero values,\ \ especially for step plots which may otherwise have lines not visible running along the bottom\ \ axis." - category: Axes tags: - axes examples: @@ -91,7 +95,6 @@ default: null desc: Set to either an object ({}) filled with options for this axis or to the name of an existing data series with its own axis to re-use that axis. See tests for usage. - category: Axes tags: - axes examples: @@ -104,7 +107,6 @@ type: String default: black desc: Color for x- and y-axis labels. This is a CSS color string. - category: Axes tags: - axes @@ -112,7 +114,6 @@ type: Integer default: 14 desc: Size of the font (in pixels) to use in the axis labels, both x- and y-axis. - category: Axes tags: - axes @@ -124,7 +125,6 @@ (for a date axis). The second argument specifies how fine-grained the axis is. For date axes, this is a reference to the time granularity enumeration, defined in dygraph-tickers.js, e.g. Dygraph.WEEKLY. opts is a function which provides access to various options on the dygraph, e.g. opts('labelsKMB'). - category: Axes tags: - axes examples: @@ -137,7 +137,6 @@ default: 50 desc: Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this also controls - category: Axes tags: - axes - labels @@ -147,7 +146,6 @@ default: black desc: Color of the x- and y-axis lines. Accepts any value which the HTML canvas strokeStyle attribute understands, e.g. 'black' or 'rgb(0, 100, 255)'. - category: Axes tags: - axes examples: @@ -157,7 +155,6 @@ type: Float default: 0.3 desc: Thickness (in pixels) of the x- and y-axis lines. - category: Axes tags: - axes @@ -165,7 +162,6 @@ type: Number default: '3.0' desc: The size of the line to display next to each tick mark on x- or y-axes. - category: Axes tags: - axes @@ -175,7 +171,6 @@ desc: Initially zoom in on a section of the graph. Is of the form [earliest, latest], where earliest/latest are milliseconds since epoch. If the data for the x-axis is numeric, the values in dateWindow must also be numbers. By default, the full range of the input is shown. - category: Axes tags: - axes examples: @@ -191,7 +186,6 @@ default: true desc: Whether to draw the x-axis. Setting this to false also prevents x-axis ticks from being drawn and reclaims the space for the chart grid/lines. - category: Axes tags: - axes examples: @@ -202,7 +196,6 @@ default: true desc: Whether to draw the y-axis. Setting this to false also prevents y-axis ticks from being drawn and reclaims the space for the chart grid/lines. - category: Axes tags: - axes examples: @@ -215,7 +208,6 @@ desc: Usually, dygraphs will use the range of the data plus some padding to set the range of the y-axis. If this option is set, the y-axis will always include zero, typically as the lowest value. This can be used to avoid exaggerating the variance in the data - category: Axes tags: - axes examples: @@ -229,7 +221,6 @@ desc: When set for a y-axis, the graph shows that axis in log scale. Any values less than or equal to zero are not displayed. Not compatible with showZero, and ignores connectSeparatedPoints. Also, showing log scale with valueRanges that are less than zero will result in an unviewable graph. - category: Axes tags: - axes examples: @@ -242,7 +233,6 @@ desc: A value representing the farthest a graph may be panned, in percent of the display. For example, a value of 0.1 means that the graph can only be panned 10% pased the edges of the displayed values. null means no bounds. - category: Axes tags: - axes - interactive elements @@ -254,7 +244,6 @@ default: null desc: Number of pixels to require between each x- and y-label. Larger values will yield a sparser axis with fewer ticks. This is set on a per-axis basis. By default, values are 60 (x-axis) or 30 (y-axes). - category: Axes tags: - axes - grid @@ -269,7 +258,6 @@ tick marks so, if you set this option, you'll most likely want to call one of them and modify the result. By default, uses Dygraph.dateTicker or Dygraph.numericTicks, but see dygraph-tickers.js for an extensive discussion. This is set on a per-axis basis. - category: Axes tags: - axes @@ -278,7 +266,6 @@ default: null desc: Explicitly set the vertical range of the graph to [low, high]. This may be set on a per-axis basis to define each y-axis separately. By default, the full range of the input is shown. - category: Axes tags: - axes examples: @@ -296,7 +283,6 @@ default: null desc: Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize. - category: Axes tags: - axes @@ -304,7 +290,6 @@ type: Integer default: 50 desc: Width, in pixels, of the x-axis labels. - category: Axes tags: - axes examples: @@ -316,7 +301,6 @@ default: 50 desc: Width, in pixels, of the y-axis labels. This also affects the amount of space available for a y-axis chart label. - category: Axes tags: - axes examples: @@ -331,7 +315,6 @@ default: ',' desc: The delimiter to look for when separating fields of a CSV file. Setting this to a tab is not usually necessary, since tab-delimited data is auto-detected. - category: CSV parsing tags: - csv parsing @@ -344,7 +327,6 @@ * Dygraphs is slightly more accepting in the dates which it will parse. See code for details. - category: CSV parsing tags: - csv parsing @@ -357,7 +339,6 @@ \ data coordinates of the point (with dates/times as millis since epoch) \n * canvasx/canvasy:\ \ The canvas coordinates at which the point is drawn. \n name: The name of the data series to\ \ which the point belongs" - category: Callbacks tags: - callbacks examples: @@ -369,7 +350,6 @@ desc: When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning. The first parameter is the dygraph being drawn. The second is a boolean value indicating whether this is the initial draw. - category: Callbacks tags: - callbacks examples: @@ -387,7 +367,6 @@ desc: 'When set, this callback gets called every time a new point is highlighted. The parameters are the JavaScript mousemove event, the x-coordinate of the highlighted points and an array of highlighted points: [ {name: ''series'', yval: y-value}, ... ]' - category: Callbacks tags: - callbacks examples: @@ -398,7 +377,6 @@ type: function(canvas, area, dygraph) default: null desc: When set, this callback gets called before the chart is drawn. It details on how to use this. - category: Callbacks tags: - callbacks examples: @@ -413,7 +391,6 @@ default: null desc: When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph. The parameter is the mouseout event. - category: Callbacks tags: - callbacks examples: @@ -426,7 +403,6 @@ desc: A function to call when the zoom window is changed (either by zooming in or out). minDate and maxDate are milliseconds since epoch. yRanges is an array of [bottom, top] pairs, one for each y-axis. - category: Callbacks tags: - callbacks examples: @@ -439,7 +415,6 @@ default: null desc: Text to display above the chart. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-title' classes. - category: Chart labels tags: - chart labels examples: @@ -457,7 +432,6 @@ desc: Height of the chart title, in pixels. This also controls the default font size of the title. If you style the title on your own, this controls how much space is set aside above the chart for the title's div. - category: Chart labels tags: - chart labels examples: @@ -469,7 +443,6 @@ desc: Height of the x-axis label, in pixels. This also controls the default font size of the x-axis label. If you style the label on your own, this controls how much space is set aside below the chart for the x-axis label's div. - category: Chart labels tags: - chart labels @@ -478,7 +451,6 @@ default: null desc: Text to display below the chart's x-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-xlabel' classes. - category: Chart labels tags: - chart labels examples: @@ -494,7 +466,6 @@ a secondary y-axis is present. See this test for an example of how to do this. The comments for the 'ylabel' option generally apply here as well. This label gets a 'dygraph-y2label' instead of a 'dygraph-ylabel' class. - category: Chart labels tags: - chart labels examples: @@ -506,7 +477,6 @@ default: 18 desc: Width of the div which contains the y-axis label. Since the y-axis label appears rotated 90 degrees, this actually affects the height of its div. - category: Chart labels tags: - chart labels @@ -520,7 +490,6 @@ the y-axis tick labels using the yAxisLabelWidth option. If you need a wider div for the y-axis label, either style it that way with CSS (but remember that it's rotated, so width is controlled by the 'height' property) or set the yLabelWidth option. - category: Chart labels tags: - chart labels examples: @@ -534,19 +503,6 @@ - temperature-sf-ny - two-axes-vr -- name: file - type: String (URL of CSV or CSV), GViz DataTable or 2D Array - default: null - desc: Sets the data being displayed in the chart. This can only be set when calling updateOptions; - it cannot be set from the constructor. For a full description of valid data formats, see the Data - Formats page. - category: Data - tags: - - data - examples: - - drawing - - dygraph-many-points-benchmark - - name: connectSeparatedPoints type: Boolean default: false @@ -554,7 +510,6 @@ gap and draws it as such. If, instead, the missing values represents an x-value for which only a different series has data, then you'll want to connect the dots by setting this to true. To explicitly include a gap with this option set, use a value of NaN. - category: Data Line display tags: - data line display examples: @@ -566,7 +521,6 @@ default: false desc: Draw a small dot at each point, in addition to a line going through the point. This makes the individual data points easier to see, but can increase visual clutter in the chart. - category: Data Line display tags: - data line display examples: @@ -583,7 +537,6 @@ type: Boolean default: false desc: Should the area underneath the graph be filled? This option is not compatible with error bars. - category: Data Line display tags: - data line display examples: @@ -597,7 +550,6 @@ desc: The size of the dot to draw on each point in pixels (see drawPoints). A dot is always drawn when a point is "isolated", i.e. there is a missing point on either side of it. This also controls the size of those dots. - category: Data Line display tags: - data line display examples: @@ -607,7 +559,6 @@ type: Boolean default: false desc: If set, stack series on top of one another rather than drawing them independently. - category: Data Line display tags: - data line display examples: @@ -617,7 +568,6 @@ type: Boolean default: false desc: When set, display the graph as a step plot instead of a line plot. - category: Data Line display tags: - data line display examples: @@ -631,7 +581,6 @@ desc: A custom pattern array where the even index is a draw and odd is a space in pixels. If null then it draws a solid line. The array should have a even length as any odd lengthed array could be expressed as a smaller even length array. - category: Data Line display tags: - data line display examples: @@ -642,7 +591,6 @@ default: 1 desc: The width of the lines connecting data points. This can be used to increase the contrast or some graphs. - category: Data Line display tags: - data line display examples: @@ -661,7 +609,6 @@ default: true desc: Which series should initially be visible? Once the Dygraph has been constructed, you can access and modify the visibility of each series using the visibility and setVisibility methods. - category: Data Line display tags: - data line display examples: @@ -673,7 +620,6 @@ type: Float (0.0 - 1.0) default: 1.0 desc: If colors is not specified, saturation of the automatically-generated data series colors. - category: Data Series Colors tags: - data series colors @@ -682,7 +628,6 @@ default: 1.0 desc: If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5) - category: Data Series Colors tags: - data series colors @@ -691,7 +636,6 @@ default: null desc: List of colors for the data series. These can be of the form "#AABBCC" or "rgb(255,100,200)" or "yellow", etc. If not specified, equally-spaced points around a color wheel are used. - category: Data Series Colors tags: - data series colors examples: @@ -708,7 +652,6 @@ partial transparency. This sets the transparency. A value of 0.0 means that the error bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark as the line for the series itself. This can be used to produce chart lines whose thickness varies at each point. - category: Data Series Colors tags: - data series colors - error bars @@ -718,7 +661,6 @@ default: null desc: Set this option to log timing information. The value of the option will be logged along with the timimg, so that you can distinguish multiple dygraphs on the same page. - category: Debugging tags: - debugging examples: @@ -729,7 +671,6 @@ default: null desc: 'Prefer axes { x: { pixelsPerLabel } }' hidden: true - category: Deprecated tags: - deprecated @@ -738,7 +679,6 @@ default: null desc: 'Prefer axes: { y: { pixelsPerLabel } }' hidden: true - category: Deprecated tags: - deprecated examples: @@ -749,7 +689,6 @@ default: null desc: 'Prefer axes { x: { axisLabelFormatter } }' hidden: true - category: Deprecated tags: - deprecated @@ -758,7 +697,6 @@ default: null desc: 'Prefer axes: { x: { valueFormatter } }' hidden: true - category: Deprecated tags: - deprecated @@ -767,7 +705,6 @@ default: null desc: 'Prefer axes: { y: { axisLabelFormatter } }' hidden: true - category: Deprecated tags: - deprecated @@ -776,7 +713,6 @@ default: null desc: 'Prefer axes: { y: { valueFormatter } }' hidden: true - category: Deprecated tags: - deprecated examples: @@ -788,9 +724,8 @@ default: false desc: When set, parse each CSV cell as "low;middle;high". Error bars will be drawn for each point between low and high, with the series itself going through middle. - category: Error Bars tags: - - error bar + - error bars - bars - csv - parsing @@ -806,7 +741,6 @@ default: false desc: Does the data contain standard deviations? Setting this to true alters the input format (see above). - category: Error Bars tags: - error bars - bars @@ -843,7 +777,6 @@ default: false desc: When set, attempt to parse each cell in the CSV file as "a/b", where a and b are integers. The ratio will be plotted. This allows computation of Wilson confidence intervals (see below). - category: Error Bars tags: - error bars - bars @@ -858,7 +791,6 @@ type: Float default: 2.0 desc: When errorBars is set, shade this many standard deviations above/below each point. - category: Error Bars tags: - error bars @@ -868,7 +800,6 @@ desc: Use in conjunction with the "fractions" option. Instead of plotting +/- N standard deviations, dygraphs will compute a Wilson confidence interval and plot that. This has more reasonable behavior for ratios close to 0 or 1. - category: Error Bars tags: - error bars @@ -876,7 +807,6 @@ type: Boolean default: true desc: Whether to display vertical gridlines under the chart. - category: Grid tags: - grid examples: @@ -887,7 +817,6 @@ type: Boolean default: true desc: Whether to display horizontal gridlines under the chart. - category: Grid tags: - grid examples: @@ -898,7 +827,6 @@ type: String default: rgb(128,128,128) desc: The color of the gridlines. This can be of the form "#AABBCC" or "rgb(255,100,200)" or "yellow". - category: Grid tags: - grid examples: @@ -910,7 +838,6 @@ default: 0.3 desc: Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal gridlines can be turned off entirely by using the drawXGrid and drawYGrid options. - category: Grid tags: - grid @@ -920,7 +847,6 @@ desc: Set this option to animate the transition between zoom windows. Applies to programmatic and interactive zooms. Note that if you also set a drawCallback, it will be called several times on each zoom. If you set a zoomCallback, it will only be called after the animation is complete. - category: Interactive Elements tags: - interactive elements examples: @@ -931,7 +857,6 @@ type: Integer default: 3 desc: The size in pixels of the dot drawn over highlighted points. - category: Interactive Elements tags: - interactive elements examples: @@ -945,7 +870,6 @@ type: Object default: null desc: 'TODO(konigsberg): document this' - category: Interactive Elements tags: - interactive elements examples: @@ -960,7 +884,6 @@ \ * xval/yval: The data coordinates of the point (with dates/times as millis since epoch) \n *\ \ canvasx/canvasy: The canvas coordinates at which the point is drawn. \n name: The name of the\ \ data series to which the point belongs" - category: Interactive Elements tags: - interactive elements - callback @@ -973,7 +896,6 @@ default: 40 desc: Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time. - category: Interactive Elements tags: - interactive elements examples: @@ -984,7 +906,6 @@ default: '#A7B1C4' desc: The range selector mini plot fill color. This can be of the form "#AABBCC" or "rgb(255,100,200)" or "yellow". You can also specify null or "" to turn off fill. - category: Interactive Elements tags: - interactive elements examples: @@ -995,7 +916,6 @@ default: '#808FAB' desc: The range selector mini plot stroke color. This can be of the form "#AABBCC" or "rgb(255,100,200)" or "yellow". You can also specify null or "" to turn off stroke. - category: Interactive Elements tags: - interactive elements examples: @@ -1005,7 +925,6 @@ type: Boolean default: false desc: Show the range selector widget. This option can only be specified at Dygraph creation time. - category: Interactive Elements tags: - interactive elements examples: @@ -1015,7 +934,6 @@ type: Boolean default: true desc: Whether to hide the legend when the mouse leaves the chart area. - category: Legend tags: - legend - interactive elements @@ -1029,7 +947,6 @@ objections, this is determined by context. For raw data, this must be specified. If it is not, default values are supplied and a warning is logged. By default, labels roughly follow ["X", "Y1", "Y2", ...]* - category: Legend tags: - legend examples: @@ -1063,7 +980,6 @@ default: null desc: Show data labels in an external div, rather than on the graph. This value can either be a div element or a div id. - category: Legend tags: - legend examples: @@ -1078,7 +994,6 @@ default: null desc: 'Additional styles to apply to the currently-highlighted points div. For example, { ''font-weight'': ''bold'' } will make the labels bold.' - category: Legend tags: - legend examples: @@ -1093,7 +1008,6 @@ type: Integer default: 250 desc: Width (in pixels) of the div which shows information on the currently-highlighted points. - category: Legend tags: - legend examples: @@ -1104,7 +1018,6 @@ type: Boolean default: false desc: Put
between lines in the label string. Often used in conjunction with labelsDiv. - category: Legend tags: - legend examples: @@ -1117,7 +1030,6 @@ type: Boolean default: true desc: Show zero value labels in the labelsDiv. - category: Legend tags: - legend examples: @@ -1128,7 +1040,6 @@ default: onmouseover desc: When to display the legend. By default, it only appears when a user mouses over the chart. Set it to "always" to always display a legend of some sort. - category: Legend tags: - legend examples: @@ -1144,7 +1055,6 @@ type: Boolean default: true desc: Whether to show the legend upon mouseover. - category: Legend tags: - legend - interactive elements @@ -1156,7 +1066,6 @@ default: 5 desc: Number of pixels to leave blank at the right edge of the Dygraph. This makes it easier to highlight the right-most data point. - category: Overall display tags: - overall display @@ -1164,7 +1073,6 @@ type: Integer >= 1 default: 1 desc: Number of days over which to average data. Discussed extensively above. - category: Rolling Averages tags: - rolling averages - error bars @@ -1198,7 +1106,6 @@ type: Boolean default: false desc: If the rolling average period text box should be shown. - category: Rolling Averages tags: - rolling averages - interactive elements @@ -1224,7 +1131,6 @@ value of 2 you'll get '0', '0.1', '0.12', '123.45' but not '123.456' (it will be rounded to '123.46'). Numbers with absolute value less than 0.1^digitsAfterDecimal (i.e. those which would show up as '0.00') will be displayed in scientific notation. - category: Value display/formatting tags: - value display/formatting examples: @@ -1234,7 +1140,6 @@ type: Boolean default: false desc: Show K/M/B for thousands/millions/billions on y-axis. - category: Value display/formatting tags: - value display/formatting examples: @@ -1252,7 +1157,6 @@ default: false desc: Show k/M/G for kilo/Mega/Giga on y-axis. This is different than labelsKMB in that it uses base 2, not 10. - category: Value display/formatting tags: - value display/formatting examples: @@ -1266,7 +1170,6 @@ If there are more than maxNumberWidth digits to the left of the decimal in a number, dygraphs will switch to scientific notation, even when not operating in scientific mode. If you'd like to see all those digits, set this to something large, like 20 or 30. - category: Value display/formatting tags: - value display/formatting examples: @@ -1279,7 +1182,6 @@ If you'd prefer to have a fixed number of significant figures, set this option to that number of sig figs. A value of 2, for instance, would cause 1 to be display as 1.0 and 1234 to be displayed as 1.23e+3. - category: Value display/formatting tags: - value display/formatting examples: @@ -1293,7 +1195,6 @@ This is usually set on a per-axis basis. For date axes, you can call new Date(millis) to get a Date object. opts is a function you can call to access various options (e.g. opts('labelsKMB')). Default formatter will depend on the type of your data. - category: Value display/formatting tags: - value display/formatting - legend @@ -1308,7 +1209,6 @@ options, the zoom flags are not changed to reflect a zoomed state. This is primarily useful for when the display area of a chart is changed programmatically and also where manual zooming is allowed and use is made of the isZoomed method to determine this. - category: Zooming tags: - zooming examples: diff --git a/package.co b/package.co index b3d6547..6e7b0f4 100644 --- a/package.co +++ b/package.co @@ -22,6 +22,7 @@ dependencies : 'underscore' : '>= 1.3.1' 'underscore.string' : '>= 2.0.0' 'js-yaml' : '>= 0.3.5' + 'hashish' : '>= 0.0.4' 'backbone' : '>= 0.9.1' devDependencies : 'buildtools' : 'https://github.com/dsc/node-buildtools/tarball/master' diff --git a/package.json b/package.json index e3df6ae..aeae543 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "underscore": ">= 1.3.1", "underscore.string": ">= 2.0.0", "js-yaml": ">= 0.3.5", + "hashish": ">= 0.0.4", "backbone": ">= 0.9.1" }, "devDependencies": { diff --git a/www/css/colors.styl b/www/css/colors.styl index 6fd557b..82a3e5d 100644 --- a/www/css/colors.styl +++ b/www/css/colors.styl @@ -1,26 +1,31 @@ /** Project Colors **/ -$dark = #333 -$light = #eee +$dark = #333 +$light = #eee /* spot colors */ -$hilite_dkblue = #182B53 -$hilite_ltblue = #4596FF -$hilite_steelblue = #A6D9FF -$hilite_teal = #00FFBC -$hilite_green = #83BB32 -$hilite_lime = #B1E43B -$hilite_yellow = #F1D950 -$hilite_squash = #EF8158 -$hilite_orange = #DC3522 -$hilite_red = #AD3238 -$hilite_pink = #FF87FF -$hilite_magenta = #FF0097 -$hilite_purple = #553DC9 -$hilite_periwinkle = #9DA5FF - - -$hilites = ($hilite_dkblue $hilite_ltblue $hilite_steelblue $hilite_teal $hilite_green $hilite_lime $hilite_yellow $hilite_squash $hilite_orange $hilite_red $hilite_pink $hilite_magenta $hilite_purple $hilite_periwinkle) +$hilite_dkblue = #182B53 +$hilite_sky = #0080FF +$hilite_ltblue = #4596FF +$hilite_steelblue = #A6D9FF +$hilite_cyan = #00FFBC +$hilite_hurricane = #254A59 +$hilite_tourquoise = #32938A +$hilite_green = #83BB32 +$hilite_lime = #B1E43B +$hilite_yellow = #F1D950 +$hilite_squash = #EF8158 +$hilite_orange = #DC3522 +$hilite_watermelon = #C9313D +$hilite_red = #AD3238 +$hilite_pink = #FF87FF +$hilite_magenta = #FF0097 +$hilite_purple = #553DC9 +$hilite_periwinkle = #9DA5FF +$hilite_lavender = #9323FF + +$hilites = ($hilite_dkblue $hilite_sky $hilite_ltblue $hilite_steelblue $hilite_cyan $hilite_hurricane $hilite_tourquoise $hilite_green $hilite_lime $hilite_yellow $hilite_squash $hilite_orange $hilite_watermelon $hilite_red $hilite_pink $hilite_magenta $hilite_purple $hilite_periwinkle $hilite_lavender) + /* background colors */ diff --git a/www/css/graph.styl b/www/css/graph.styl index 30f4b2c..cdd2b77 100644 --- a/www/css/graph.styl +++ b/www/css/graph.styl @@ -124,14 +124,19 @@ section.graph /* Category Colors {{{ */ for i in 0...length($hilites) + $bg_color = $hilites[i] + $fg_color = light($bg_color) ? $dark : $light + &.category_{i} - $bg_color = $hilites[i] - $fg_color = light($bg_color) ? $dark : $light - - background-color $bg_color color $fg_color + background-color $bg_color label, h1, h2, h3, .shortname, .name, .close color $fg_color + + .tag{i} + color $fg_color + background-color $bg_color + border 1px solid $fg_color