I am displaying line chart using chart js in angular. In x-axis I am showing date which is dynamic which is coming from api. I tried "type:'linear'" but still it is not working.
I want that dates which I am displaying should be uniform.
my component.html
<canvas id="myChart"></chart>
my component.ts file
ngOnInit(){
this.chart = document.getElementById('myChart')
this.loadchart();
}
loadchart(){
new Chart(this.chart, {
type: 'line',
data: {
datasets: [{
data: this.carArray,
label: 'No. of car',
backgroundColor: 'rgba(255, 99, 132, 1)',
fill:true
},
{
data: this.priceArray,
label: 'price',
backgroundColor: 'rgba(255, 99, 132, 1)',
fill:true
}],
labels: this.dateArray,
},
options: {
elements:{
point: {
radius:1
},
},
plugins: {
legend: {
display:true
}
},
responsive: true,
scales: {
y: {
grid: {
borderDash:[1,2],
},
brginAtZero: true
},
x: {
ticks:{
color: 'blue'
},
grid: {
tickColor: 'red',
borderDash:[1,2],
},
brginAtZero: true
}
}
}
})
}
I want to display uniform dates on x axis.
I'm using b-table from bootstrapVue3 https://cdmoro.github.io/bootstrap-vue-3/ but it does not render the UI element.
On github page, it seems b-table is already implemented but I do not know what I am doing wrong.
<template>
<div>
<b-table hover :items="items"></b-table>
</div>
</template>
<script>
export default {
setup() {
const items = [
{ age: 40, first_name: "Dickerson", last_name: "Macdonald" },
{ age: 21, first_name: "Larsen", last_name: "Shaw" },
{
age: 89,
first_name: "Geneva",
last_name: "Wilson",
_rowVariant: "danger",
},
{
age: 40,
first_name: "Thor",
last_name: "MacDonald",
_cellVariants: { age: "info", first_name: "warning" },
},
{ age: 29, first_name: "Dick", last_name: "Dunlap" },
];
return {
items,
};
},
};
</script>
renders nothing but text
If I use another component like b-button, it renders as it should.
Thank you for your help!
I have problem with Inverse Backgrounds in FullCalendar v4.0.2.
code:
let calendarEl = document.getElementById(this.element_id);
this.calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'timeGrid' ],
height: "auto",
nowIndicator : true,
defaultView: 'timeGridDay',
events: [
{
id: 2,
start: '2019-04-17 10:00:00',
end: '2019-04-17 11:00:00',
color: 'blue',
rendering: 'inverse-background'
} , {
id: 2,
start: '2019-04-17 14:00:00',
end: '2019-04-17 15:00:00',
color: 'green',
rendering: 'inverse-background'
}
]
});
this.calendar.render();
when i use this code events that share the same id wouldn't grouped together when this rendering happens.
I'm not entirely sure but I think you're using the wrong view for that type of rendering.
const el = document.querySelector("#calendar");
const calendar = new FullCalendar.Calendar(el, {
plugins: ['timeGrid'],
defaultView: 'timeGridWeek',
events: [
{
id: 2,
start: '2019-04-17 10:00:00',
end: '2019-04-17 11:00:00',
color: 'blue',
rendering: 'inverse-background'
} , {
id: 2,
start: '2019-04-17 14:00:00',
end: '2019-04-17 15:00:00',
color: 'blue',
rendering: 'inverse-background'
}
]
});
calendar.render();
https://codepen.io/anon/pen/rbJyzv 👀
I have a written a stats chart using highchairs.com for the daily visits and installs. I want to show the tooltip with Datetime and Names with total values for each series when hover or on click event.
Highcharts tooltip shared Data shared output is displaying with names but not the date and time correctly when you mouseover on the markers.
What I'm doing wrong?
The code I have written is on jsfiddle as well.
$(function () {
$('#campaign-container').highcharts({
chart: {
type: 'areaspline',
},
title: {
text: null
},
credits: {
enabled: false,
},
navigation: {
buttonOptions: {
enabled: false
}
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
day:"%b %e, %Y",
},
tickInterval: 2,
allowDecimals: false,
labels: {
formatter: function () {
return this.value; // clean, unformatted number for year
}
}
},
yAxis: {
min: 0,
max: 3000,
tickInterval: 1000,
title: {
text: ''
},
labels: {
formatter: function () {
return this.value / 1000 + 'k';
}
}
},
tooltip: {
shared: true
},
legend: {
align: 'left',
verticalAlign: 'bottom',
layout: 'horizontal',
x: 0,
y: 0
},
plotOptions: {
areaspline: {
lineWidth: null,
marker: {
enabled: false,
radius: 5
}
}
},
series: [{
name: 'Visits',
color: '#d3d3d3',
data: [750,850,1000,1250,1050,950,720,850,650,750,950,1050,1150,1250,1450,1650,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20]
}, {
name: 'Installs',
color: '#e77378',
data: [550,650,750,850,950,1050,1150,1250,1150,1050,950,850,750,650,550,450,750,20,20,20,20,20,20,20,20,20,20,20,20,20,20]
}]
});
});
You need to provide either:
1) a pointStart and pointInterval property, on the series level (either in the plotOptions, or in the series object)
2) datetime values in the x values of your data
The datetime values can either by epoch time stamps (in milliseconds), or Date.UTC() objects.
The pointInverval, if used, must be in milliseconds.
Example using the pointStart and pointInterval properties:
http://jsfiddle.net/jlbriggs/7yrnreLx/3/
I have updated the code with the correct date time values and added the customised crosshair.
Here is the final code with a correct data values
$(function () {
$('#container').highcharts({
chart: {
type: 'areaspline'
},
title: {
text: null
},
credits: {
enabled: false,
},
navigation: {
buttonOptions: {
enabled: false
}
},
xAxis: {
type: 'datetime',
tickInterval: 2,
dateTimeLabelFormats: {
day:"%e",
},
crosshair: {
color:'#e77378',
zIndex: 2,
width: 3,
}
},
yAxis: {
min: 0,
max: 3000,
tickInterval: 1000,
title: {
text: ''
},
labels: {
formatter: function () {
return this.value / 1000 + 'k';
}
}
},
tooltip: {
shared: true
},
legend: {
align: 'left',
verticalAlign: 'bottom',
layout: 'horizontal',
x: 0,
y: 0
},
plotOptions: {
series: {
cursor: 'pointer',
pointStart: Date.UTC(2016,0,1),
pointInterval: 86400000, //1 day
},
},
areaspline: {
lineWidth: null,
marker: {
enabled: false,
lineColor:'#e77378',
fillColor:'#ffffff',
lineWidth: 3,
radius: 4,
symbol:'circle'
}
}
},
series: [{
name: 'Visits',
color: '#d3d3d3',
data: [750,850,1000,1250,1050,950,720,850,650,750,950,1050,1150,1250,1450,1650,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20]
}, {
name: 'Installs',
color: '#e77378',
data: [550,650,750,850,950,1050,1150,1250,1150,1050,950,850,750,650,550,450,750,20,20,20,20,20,20,20,20,20,20,20,20,20,20]
}]
});
});
I'm trying to implement a simple grid using jqGrid, my first read example of my own.
Here is my JSON code:
$(document).ready(function() {
$("#editgrid").jqGrid({
url: '<%= ResolveUrl("~/User/index") %>',
datatype: "json",
myType: 'GET',
colNames: ['UserId', 'Surname', 'Forename', 'Pax', 'Mobile', 'Active', 'Email'],
colModel: [
{ name: 'UserId', index: 'UserId', width: 80, editable: true, editoptions: { size: 10} },
{ name: 'Surname', index: 'Surname', width: 90, editable: true, editoptions: { size: 25} },
{ name: 'Forename', index: 'Forename', width: 60, align: "right", editable: true, editoptions: { size: 10} },
{ name: 'Pax', index: 'Pax', width: 60, align: "right", editable: true, editoptions: { size: 10} },
{ name: 'Mobile', index: 'Mobile', width: 60, align: "right", editable: true, editoptions: { size: 10} },
{ name: 'Active', index: 'Active', width: 55, align: 'center', editable: true, edittype: "checkbox", editoptions: { value: "Yes:No"} },
{ name: 'Email', index: 'Email', width: 100, sortable: false, editable: true, edittype: "textarea", editoptions: { rows: "2", cols: "20"} }
],
rowNum: 10,
rowList: [10, 20, 30],
pager: '#pagered',
sortname: 'Surname',
viewrecords: true,
sortorder: "desc",
caption: "Editing Example",
editurl: "detail.aspx"
});
$("#bedata").click(function() {
var gr = jQuery("#editgrid").jqGrid('getGridParam', 'selrow');
if (gr != null) jQuery("#editgrid").jqGrid('editGridRow', gr, { height: 280, reloadAfterSubmit: false });
else alert("Please Select Row");
});
});
I have the following HTML :
<table id="editgrid"></table>
<div id="pagered"></div>
<input type="button" id="bedata" value="Edit Selected" />
But when I run all this I get client code breaking within jquery-1.5.2.js (Microsoft JScript runtime error: Object doesn't support this property or method) where I can do nothing about this, this is probably of no use but here is the error below, stops at the finally part :
// resolve with given context and args
resolveWith: function( context, args ) {
if ( !cancelled && !fired && !firing ) {
// make sure args are available (#8421)
args = args || [];
firing = 1;
try {
while( callbacks[ 0 ] ) {
callbacks.shift().apply( context, args );
}
}
finally {
fired = [ context, args ];
firing = 0;
}
}
return this;
},
Must be something simple making this crash out on me, any ideas anyone?