How to have two trees on the same page with diff icons:
.k-treeview .k-minus {
background: url('../images/k-minus.png') center center;
}
.k-treeview .k-plus {
background: url('../images/k-plus.png') center center;
}
Any help would be great.
This question is a little bit unspecified but I'll try to help you.First off all, to display images in treeView you have to options:
Sprites - you provide css class for all images you wanna display. All can be in same image file like here: http://demos.kendoui.com/content/web/treeview/coloricons-sprite.png
Images - you provide url for each image in single file: http://demos.kendoui.com/content/web/treeview/mail.png
Assuming you got two treeViews in you site with diferrent names like TreeView1 and TreeView2. If this treeViews are similar but just need to have different icons, better solution is sprites option, the simplest way is to prepare 2 different images and provide css to display it, like:
#TreeView1 .k-sprite {
background-image: url("../../content/web/treeview/coloricons-sprite.png");
}
#TreeView2 .k-sprite {
background-image: url("../../content/web/treeview/different-sprite.png");
}
.rootfolder { background-position: 0 0; }
.folder { background-position: 0 -16px; }
.pdf { background-position: 0 -32px; }
.html { background-position: 0 -48px; }
.image { background-position: 0 -64px; }
Now you can have 2 identical but name treeViews with different icons, eg:
$("#TreeView1").kendoTreeView({
dataSource: [{
text: "My Documents", expanded: true, spriteCssClass: "rootfolder", items: [
{
text: "Kendo UI Project", expanded: true, spriteCssClass: "folder", items: [
{ text: "about.html", spriteCssClass: "html" },
{ text: "index.html", spriteCssClass: "html" },
{ text: "logo.png", spriteCssClass: "image" }
]
},
]
}]
});
Of course if you prefer images options you just have to describe different url for image in each treeView dataSourve for all items, like that:
$("#TreeView1").kendoTreeView({
dataSource: [
{
text: "Inbox", imageUrl: "../../content/web/treeview/mail.png",
items: [
{ text: "Read Mail", imageUrl: "../../content/web/treeview/readmail.png" }
]
},
{
text: "Drafts", imageUrl: "../../content/web/treeview/edit.png"
},
]
});
$("#TreeView2").kendoTreeView({
dataSource: [
{
text: "Inbox", imageUrl: "../../content/web/treeview/pdf.png",
items: [
{ text: "Read Mail", imageUrl: "../../content/web/treeview/jpg.png" }
]
},
{
text: "Drafts", imageUrl: "../../content/web/treeview/html.png"
},
]
});
I based on this kendoUI demo: http://demos.telerik.com/kendo-ui/treeview/images. I hope it helps.
Related
In the donut chart in #ant-design/plots,
There is a black border around the individual sections of the donut chart when hovered.
The individual section is translated away from the center when selected.
How to stop/ control these behavior?
const config = {
appendPadding: 10,
data,
angleField: 'value',
colorField: 'type',
radius: 1,
innerRadius: 0.6,
label: {
type: 'inner',
offset: '-50%',
content: '{value}',
style: {
textAlign: 'center',
fontSize: 14,
},
},
interactions: [
{
type: 'element-selected',
},
{
type: 'element-active',
},
],
statistic: {
title: false,
content: {
style: {
whiteSpace: 'pre-wrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
},
content: 'AntV\nG2Plot',
},
},
};
Deal with interactions in config
There is a black border around the individual sections of the donut chart when hovered.
Remove the object type:'element-active'
Note: Removing is conveyed by commenting out in the code below.
interactions: [
...
// {
// type: 'element-active',
// },
]
The individual section is translated away from the center when selected.
Remove the object type: 'element-selected'
Note: Removing is conveyed by commenting out in the code below.
interactions: [
...
// {
// type: 'element-selected',
// },
]
To achieve both you can simply remove the interactions from the config object.
I am drawing several pie charts using chart.js in the same page. All pie charts have the same legend. The following code is used to draw the pie-chart with the legend for each pie-chart.
$scope. drawFunction = function()
{
new Chart(canvasVal, {
type: 'bar',
data: {
labels: ["1900", "1950", "1999", "2050"],
datasets: [{
label: "Europe",
type: "line",
borderColor: "#8e5ea2",
data: [408,547,675,734],
fill: false
}, {
label: "Africa",
type: "line",
borderColor: "#3e95cd",
data: [133,221,783,2478],
fill: false
}, {
label: "Europe",
type: "bar",
backgroundColor: "rgba(0,0,0,0.2)",
data: [408,547,675,734],
}, {
label: "Africa",
type: "bar",
backgroundColor: "rgba(0,0,0,0.2)",
backgroundColorHover: "#3e95cd",
data: [133,221,783,2478]
}
]
},
options: {
title: {
display: true,
text: 'Population growth (millions): Europe & Africa'
},
legend: { display: true}
}
});
}
HTML
<canvas id="pie-chart" width="800" height="450"></canvas>
Currently the same legend is displayed for each chart. Can I display one common legend for all drawn pie-charts?
UPDATE
I am extremely sorry for tangling the code. Please find the below code snippet
$scope.drawFunc = function()
{
new Chart(document.getElementById("pie-chart"), {
type: 'pie',
data: {
labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
datasets: [{
label: "Population (millions)",
backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"],
data: [2478,5267,734,784,433]
}]
},
options: {
title: {
display: true,
text: 'Predicted world population (millions) in 2050'
},
legend: {
display: true
}
}
});
}
Instead of hard coding the boolean value for display property of legend I passed its value as a parameter each time the draw function is called.
$scope.drawFunc = function( legendBoolValue)
{
new Chart(document.getElementById("pie-chart"), {
type: 'pie',
data: {
labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
datasets: [{
label: "Population (millions)",
backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"],
data: [2478,5267,734,784,433]
}]
},
options: {
title: {
display: true,
text: 'Predicted world population (millions) in 2050'
},
legend: {
display: legendBoolValue
}
}
});
}
i can change the value of the text but am unable to change the text on the drop down of the ngx-quill
i tried both ways the ts way and the creation of a new container still doesn't fix my issue. went through the doc and still was unable to find a suitable solution to this problem.As the doc doesnt define how to change the labels
html
<div id="toolBarConfig"></div>
ts
const sizeVal = Quill.import('attributors/style/size');
sizeVal.whitelist = ['14px', '16px', '72px'];
Quill.register(sizeVal, true);
const quill = new Quill('#toolBarConfig', {
modules: {
toolbar: [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{ header: 1 }, { header: 2 }], // custom button values
[{ list: 'ordered' }, { list: 'bullet' }],
[{ script: 'sub' }, { script: 'super' }], // superscript/subscript
[{ indent: '-1' }, { indent: '+1' }], // outdent/indent
[{ direction: 'rtl' }], // text direction
[{ size: ['14px', '16px', '72px'] }], // custom dropdown
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ color: [] }, { background: [] }], // dropdown with defaults from theme
[{ font: [] }],
[{ align: [] }],
['clean'],
['table'], // remove formatting button
['link', 'image', 'video'], //
link and image, video
],
},
theme: 'snow',
});
SCSS
.ql-snow .ql-picker.ql-size span[data-label="14px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-
value="14px"]::before {
content: '14px'!important;
font-size: 14px !important;
}
.ql-snow .ql-picker.ql-size span[data-label="16px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-
value="16px"]::before {
content: '16px'!important;
font-size: 16px !important;
}
.ql-snow .ql-picker.ql-size span[data-label="72px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-
value="72px"]::before {
content: '72px'!important;
font-size: 72px !important;
}
How to add font types on Quill js with toolbar options?
follow this stackoverflow thread.. the end result
I have a series data like this [null,0,null,null,null,null,0.86,null,0,null]
As you can see, there are only three points in it.
However it has been displayed as below,
Please see the demo here,
Highcharts.chart('container', {
chart: {
type: 'area',
spacingBottom: 30
},
title: {
text: 'Fruit consumption *'
},
xAxis: {
categories: ["Term 3_week1","Term 3_week2","Term 3_week3","Term 3_week4","Term 3_week5","Term 3_week6","Term 3_week7","Term 3_week8","Term 3_week9","Term 3_week10"]
},
yAxis: {
title: {
text: 'Y-Axis'
}
},
plotOptions: {
area: {
fillOpacity: 0.5
}
},
credits: {
enabled: false
},
series: [{
name: 'John',
data: [null,0,null,null,null,null,0.86,null,0,null]
}]
});
I am quite confused why this been displayed like this.
Can anyone help?
Thanks
First if you look your demo on firefox it will only show 3 points without any area.
Now you may try to use connectNulls Api Doc like that :
chart: {
type: 'scatter',
spacingBottom: 30
},
plotOptions: {
area: {
fillOpacity: 0.5,
connectNulls:true
}
},
Edit: New type of chart
Updated Fiddle
I am using Angular google chart (ng-google-chart) for drawing the graph.
I drew the Bar graph using the sample provided in http://bouil.github.io/angular-google-chart/#/generic/ColumnChart.
I am able the draw the Bar Chart.
But I would like to dynamically add the colors to the Bar based on the values.
I am not able to achieve this using https://github.com/bouil/angular-google-chart.
Below is my code sample :
$scope.arrVal2 = [22,31,90,50,80,25,15];
$scope.chartObj1 = [];
$scope.chartObj2 = [];
$scope.createChartObj = function()
{
for(var m=0; m < $scope.arrVal2.length; m++)
{
console.log('val of m ----- '+m);
$scope.chartObj2.push({c:[{v:m+1},{v:$scope.arrVal2[m]}
]})
}
}
$scope.chartObject2.data = {"cols": [
{id: "day", label: "Day", type: "string"},
{id: "events", label: "Event", type: "number"}
], "rows": $scope.chartObj2
};
$scope.chartObject2.type = 'ColumnChart';
$scope.chartObject2.options = {
'title': 'PREVIOUS 7 WEEKS',
'titleTextStyle': {color: '#FFFFFF', fontSize: 13,bold: false},
'backgroundColor': '#555555',
legend: 'none',
series: {
0: { color: '#e2431e' },
1: { color: '#e7711b' },
2: { color: '#f1ca3a' },
3: { color: '#6f9654' },
4: { color: '#1c91c0' },
5: { color: '#43459d' },
6: { color: '#43459d' }
},
colors: ['#6EAF19', '#E2B400', '#DF0000','#DF0000','#DF0000','#DF0000','#DF0000'],
is3D:true,
animation:{
duration: 3000,
easing: 'out',
},
hAxis: {
gridlines: {color: 'transparent'},
textPosition: 'none'
},
vAxis:{
minValue:0,
maxValue:100,
baselineColor: 'none',
gridlineColor: 'none',
gridlines: {color: 'transparent'},
textPosition: 'none'
}
}
Have tried adding using Series, tried adding colors: ['black','blue','white','blue','blue','blue','blue'] in options :( Only the first color in the series is getting applied.
Can any one please help me in this.
Thanks IN ADVANCE:)
Normally, the charts color data by data series (that is, DataTable column); if you want to color individual bars, you need to use a "style" role column to set the colors:
$scope.chartObject2.data = {
"cols": [
{id: "day", label: "Day", type: "string"},
{id: "events", label: "Event", type: "number"},
{role: "style", type: "string"}
],
"rows": $scope.chartObj2
};
when building your rows, add in the color:
$scope.chartObj2.push({c:[{v:m+1},{v:$scope.arrVal2[m]},{v:'#e2431e'}]});