Skip to content

Instantly share code, notes, and snippets.

@danswater
Last active November 16, 2017 07:15
Show Gist options
  • Select an option

  • Save danswater/33240de8eb62b2e65a753028f45d98d2 to your computer and use it in GitHub Desktop.

Select an option

Save danswater/33240de8eb62b2e65a753028f45d98d2 to your computer and use it in GitHub Desktop.

Timelogs in Bar Graph

Bar Graph options

This should be appended to response as chart

{
  "type"   : "multiBarChart",
  "height" : 350,
  "margin" : {
    "top"    : 20,
    "right"  : 20,
    "bottom" : 45,
    "left"   : 45
  },
  "clipEdge"     : true,
  "duration"     : 500,
  "stacked"      : false,
  "showControls" : false,
  "noData"       : "No data available",
  "xAxis"        : {
    "axisLabel"  : "Jobs Status",
    "showMaxMin" : false
  },
  "yAxis" : {
    "axisLabel"         : "Hours",
    "axisLabelDistance" : -20
  }
}

Request payload

{
  "Interval": "monthly",
  "UserId" : 1,
  "Date": "2016-11-01",
  "Tab": "mylogs",
  "Graph" : "bar"
}

Response

{
  "title" : {
    "className" : "h4",
    "enable" : true,
    "text" : "Monthly Timelog"
  },
  "data" : [
    {
      "key" : "Submitted",
      "values" : [
        {
          "name" : "Submitted",
          "hours" : "0.00"
        }
      ]
    },
    {
      "key" : "Approved",
      "values" : [
        {
          "name" : "Approved",
          "hours" : "8.00"
        }
      ]
    },
    {
      "key" : "Rejected",
      "values" : [
        {
          "name" : "Approved",
          "hours" : "0.00"
        }
      ]
    }
  ]
}
@danswater
Copy link
Author

danswater commented Nov 16, 2017

Timelogs in Donut Graph

Container options

This should be appended to response as title.

{
	"className" : "h4",
	"enable"    : true,
	"text"      : "Monthly Timelog"
}

Donut Graph options

This should be appended to response as chart.

{
	"type"               : "pieChart",
	"donut"              : true,
	"height"             : 350,
	"labelSunbeamLayout" : true,
	"labelThreshold"     : 0.01,
	"labelOutside"       : false,
	"legend"             : {
		"align"       : false,
		"updateState" : false
	},
	"noData"             : "No data Available",
	"showLabels"         : true,
	"transitionDuration" : 500
}

Request payload

{
	"Interval" : "monthly",
	"UserId"   : 1,
	"Date"     : "2016-11-01",
	"Tab"      : "mylogs",
}

Example Response

{
	"title" : {
		"className" : "h4",
		"enable"    : true,
		"text"      : "Monthly Timelog"	
	},
	"chart" :{
		"type"               : "pieChart",
		"donut"              : true,
		"height"             : 350,
		"labelSunbeamLayout" : true,
		"labelThreshold"     : 0.01,
		"labelOutside"       : false,
		"legend"             : {
			"align"       : false,
			"updateState" : false
		},
		"noData"             : "No data Available",
		"showLabels"         : true,
		"transitionDuration" : 500
	},
	"data" : [ {
		"x" : "Submitted",
		"y" : "2.50"
	}, {
		"x" : "Approved",
		"y" : "8.00"
	}, {
		"x" : "Rejected",
		"y" : "3.10"
	} ]
}

@danswater
Copy link
Author

danswater commented Nov 16, 2017

Timelogs in Line Graph

Container options

This should be appended to response as title.

{
	"className" : "h4",
	"enable"    : true,
	"text"      : "Monthly Timelog"
}

Line Graph options

This should be appended to response as chart.

{
	"type"   : "lineChart",
	"height" : 350,
	"margin" : {
		"top"    : 20,
		"right"  : 20,
		"bottom" : 40,
		"left"   : 55
	},
	"useInteractiveGuideline" : true,

	"xAxis" : {
		"axisLabel"  : "Jobs Status",
		"showMaxMin" : false
	},

	"yAxis" : {
		"axisLabel"         : "Hours",
		"axisLabelDistance" : -10
	},
	"noData"             : "No data Available",
	"showLabels"         : true,
	"transitionDuration" : 500
}

Request payload

{
	"Interval" : "monthly",
	"UserId"   : 1,
	"Date"     : "2016-11-01",
	"Tab"      : "mylogs",
}

Example Response

{
	"title" : {
		"className" : "h4",
		"enable"    : true,
		"text"      : "Monthly Timelog"
	},
	"chart" : {
		"type"   : "lineChart",
		"height" : 350,
		"margin" : {
			"top"    : 20,
			"right"  : 20,
			"bottom" : 40,
			"left"   : 55
		},
		"useInteractiveGuideline" : true,

		"xAxis" : {
			"axisLabel"  : "Jobs Status",
			"showMaxMin" : false
		},

		"yAxis" : {
			"axisLabel"         : "Hours",
			"axisLabelDistance" : -10
		},
		"noData"             : "No data Available",
		"showLabels"         : true,
		"transitionDuration" : 500
	},
	"data" : [ {
		"values"      : [ {
			"x" : 0,
			"y" : 0
		}, {
			"x" : 1,
			"y" : 0.0998
		} ],
		"key"         : "Submitted",
		"color"       : "#ff7f0e",
		"strokeWidth" : 2,
		"classed"     : "dashed"
	}, {
		"values" : [ {
			"x" : 0,
			"y" : 0.5
		}, {
			"x" : 1,
			"y" : 0.5249
		} ],
		"key"    : "Approved",
		"color"  : "#2ca02c"
	}, {
		"values" : [ {
			"x" : 0,
			"y" : -0.1910
		}, {
			"x" : 1,
			"y" : -0.2255
		} ],
		"key"    : "Rejected",
		"color"  : "#7777ff"
	} ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment