Bullet chart using Kendo-UI with angular 2 - kendo-ui-angular2

I have a bullet chart which I can display but I don't know how to add plot ranges.
Could someone please provide a sample?

HTML
<kendo-chart-value-axis-item [min]="0" [max]="80 [plotBands]="PlotBandValues">
</kendo-chart-value-axis-item>
TS
PlotBandValues = [{
"color": "#44aa44",
"from": 48,
"opacity": 1,
"to": 57
}]

Related

How do I set relative bar width in altair?

How do I use relative bar width with altair? According to vega-lite documentation. This code:
{
"data": {"url": "data/seattle-weather.csv"},
"mark": {"type": "bar", "width": {"band": 0.7}},
"encoding": {
"x": {
"timeUnit": "month",
"field": "date"
},
"y": {
"aggregate": "mean",
"field": "precipitation"
}
}
}
produces a bar that occupies 70% of each x band.
How do I set this in altair? If I use something like:
.mark_bar(width={'band':0.7})
I got an error about width not being a number.
How do I set relative bar widths in altair?
You could also set the padding between the bars instead, using padding in the scale argument of the encoding field. For mark_bar, for example, setting it to 0.3, would set the bar width to 70% of the 'tick space'.
import altair as alt
from vega_datasets import data
source = data.seattle_weather()
alt.Chart(source).mark_bar().encode(
x=alt.X('month(date):O', scale=alt.Scale(padding=0.3)),
y='mean(precipitation):Q'
)
On the current development version of Altair on GitHub, what you suggested should work. As per this post, you should also be able to do the following:
import altair as alt
from vega_datasets import data
source = data.seattle_weather()
alt.Chart(source).mark_bar(
width=alt.RelativeBandSize(0.7)
).encode(
x='month(date):O',
y='mean(precipitation):Q'
)

How to reduce size of customized scroll bar in Sublime Text 3

I have customized my scroll bar by referencing one answer from stackoverflow.
This is my Material-Theme-Darker.sublime-theme file
[
// More visible scrollbar
{
"class": "puck_control",
"layer0.texture": "User/theme_override/scroll_puck.png",
// Optional: set to your desired RGB color
"layer0.tint": [141, 234, 255],
"layer0.opacity": 1.0,
"layer1.opacity": 0.0,
"layer0.inner_margin": 2,
},
{
"class": "puck_control",
"attributes": ["horizontal"],
"layer0.texture": "User/theme_override/scroll_puck_horiz.png",
}
]
But the scroll bar is quite bold and I want it to be short in width so can anyone tell me how can I achieve it?
In order to make the scrollbar narrower, you need to edit User/theme_override/scroll_puck.png and scroll_puck_horiz.png so that it is narrower. Then, set "content_margin" to something like this:
"content_margin": [8, 12],
and play around with the first number until you get a width you like.

Searching for string while recording a macro in VIM

I want to add a new field to objects in a list using vim. Each object is not the same number of lines. However, the last field is the same for each object.
The new field is the same for each object, so I figured I could create a vim macro that would insert the static field at the end of each object, as well as inserting a comma on the preceding line. My problem is that I am unable to perform a string search within the macro recorder, though.
Here's an example of what I'm trying to accomplish:
Input:
[
{
"prop1": 10,
"prop2": 30,
"last": 99
},
{
"prop1": 80,
"last": 10
},
{
"propA": 33,
"propB": 90,
"propC": 38,
"last": 100
}
]
Desired Output:
[
{
"prop1": 10,
"prop2": 30,
"last": 99,
"new": 0
},
{
"prop1": 80,
"last": 10,
"new": 0
},
{
"propA": 33,
"propB": 90,
"propC": 38,
"last": 100,
"new": 0
}
]
I tried to accomplish this by typing the following into vim: q q /last ENTER $ a , ESC p q. I had "new: 0 copied to my clipboard. It appears that the search part isn't working because each time I run the macro, it pastes the line where the cursor started instead of on the line with the next instance of the string "last".
You can perform this command:
:%s#\v^(\s*)"last":\s*\d*\zs#,\r\1"new": 0#g
You can still achieve that using macro:
first yank this line:
"new": 0
then perform these keystrokes:
qqq
qq/last ENTER A,ESCpq
Note: ENTER and ESC are keys on keyboards

flot opacity of pie not supported?

I do not see any examples of a pie chart with opacity and the fill property is not supported in pie charts as it is for bar charts. Can someone please provide an example of a pie chart with opacity or transparency setting (for the pie chart itself, not the labels)?
You can use an RGBA value when specifying the color for your data series to set transparency:
var data = [{
label: "Yes",
data: 50,
color: 'rgba(89, 120, 182, 1)'
}, {
label: "No",
data: 150,
color: 'rgba(89, 120, 182, .5)'
}];
JSFiddle Example

How to i set jqplot bar chart colours per bar?

I'm trying to set the colours of my jqplot bar chart bars. There will always be six bars present, grouped into sets of 2 bars. Here is an example of the data being plotted:
line1 = [6000, 5000, 5500];
line2 = [16000, 10000, 14000];
I've used the following so far:
seriesColors: ["#F3CBBF", "#BFDDE5", "#CF3501", "#027997", "#CF3501", "#027997"],
But jqplot alternates between the first 2 bars each time instead of using all of the declared colours. This is probably as it only determines 2 series being present, one per set of data.
Is there a way to set the bar colours explicitly?
I do this using the varyBarColor method so you can list the different colours for the bars in a simple array like you have done already but if there is only one series it will use these colors for each bar instead. Here is an example of my code:
plot1 = $.jqplot('chart1', [s1], {
title: 'Example Income Graph',
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions:{ varyBarColor : true },
pointLabels: { show : true }
},
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
label:'Net Growth (%)',
ticks: ticks
},
yaxis:{
label:'Income (£)',
tickOptions:{ formatString:'%d'},
autoscale:true,
min:0,
max:10000
}
},
seriesColors: [ "#eee", "#ccc", "#999"],
highlighter: { show: false }
});
In this graph I had one series with 3 bars and they are each a different colour grey.
This is pretty old, but still doesn't have the right answer, and it took me a while to figure it out, so here it goes.
You need two things:
Set the varyBarColor and a series array that contains the series colors for each series, passed at the same level as seriesDefaults, such as:
plot1 = $.jqplot('chart1', [s1, s2], {
title: 'Example',
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions:{ varyBarColor : true },
pointLabels: { show : true }
},
series: [{seriesColors: ["#F3CBBF", "#BFDDE5", "#CF3501"]},
{seriesColors: ["#027997", "#CF3501", "#027997"]}]
}
try like this
series:[{renderer:$.jqplot.BarRenderer , seriesColors: ["#F3CBBF", "#BFDDE5", #CF3501","#eee", "#ccc", "#999"] }]

Resources