Range slide not going to max value when there is steps also - html

I am setting up range slider in my angular project. The all values for range slider is coming from api.Api response for slider is looking like this.
[{
toolValue: { defaultvalue: 120,
min: 30,
max: 120,
step: 30 }
}]
I am setting up these values in range slider and the slider is working but when step value is 30 or any other then the slider is not going to max position, instead of it is setting up at position 90. But when the steps are 0.1, that time slider is set to max position . I don't know what wrong with steps.
Html code:
<input type="range" class="slider" [value]="item.toolValue.defaultvalue" [min]="item.toolValue.min" [max]="item.toolValue.max" [step]="item.toolValue.step" id="rangeslider{{index}}" (mouseup)="onMouseupRangeslider($event.target.value,item,index)">
Please let me know how to
As you can see in the upper image, From API in both slider the default value is coming 100 and 120. In first slider steps are 0.1, so that it's going to max position but in the second slider, steps are 30 so that the slider is not going to max position, instead of it is stopped at 90. Please help me with this issue. Thank you
The api response for slider values are as per below.
[{
cols: 12
id: "dvetool0"
rows: 3
toolValue: {defaultvalue: 100, max: 100, min: 0, step: 0.1}
type: "rangeslider"
x: 0
y: 0 },
{
cols: 11
id: "dvetool1"
rows: 3
toolValue: {defaultvalue: 120, max: 120, min: 30, step: 30}
type: "rangeslider"
x: 0
y: 4 }]

Updated Answer:
To follow up after your clarification, I think your problem is the use of the [value] DOM property here. Instead, try tracking the value with ngModel instead.
Replace [value]="default" with [(ngModel)]="inputValue" and create the inputValue variable in your component.ts
Here's a working stackblitz as an example: https://stackblitz.com/edit/angular-szdxyn
By the way, the reason you were seeing 90 is because the browser calculates a a default value using rangeElem.min + (rangeElem.max - rangeElem.min)/2. See the MDN page: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#Value

Related

Remove spacing between bar in bar graph( react-chart-js)

issue that i am facing is, i have my bar graph made using react-chart-js. i want to remove space between the bar and center align the bar's . The bar's should have Thickness equal to 50
I try using dummy data ,that way i got the desired output but that is not the correct way of doing . Also I try using barPercentage , categoryPercentage option but didnt get the desired output
Link for CodeSandbox
I don't know if this actually works out of the box. There is nothing in the documentation about this use case either.
You could do it with ghost values to extend the chart in general.
This is not really a solution, but it may be an option.
const labels = ["","","January", "February", "March","",""];
export const data = {
labels,
datasets: [
{
label: "Dataset 1",
data: labels.map((elem, index) => {
if (index > 1 && index < 5)
return faker.datatype.number({ min: 0, max: 1000 })
}),
backgroundColor: "rgba(255, 99, 132, 0.5)",
barThickness: 50
}
]
};

Setting a fixed amount of y Axis Lines to display on Apache ECharts

I'm trying to show only a certain amount of yAxis Lines in my Apache ECharts Chart.
I tried the following:
yAxis: [
{
type: 'value',
min:0,
max:6000
}
],
yAxis: [
{
type: 'value',
scale:true,
splitNumber:4,
}
],
I need to dislpay it like this:
For your information: I need this to work on every Chart-Type, Line Chart, Bar Chart etc.
Thanks in advance :)
So, as I have not got any answer. I wanted to share with anyone who might need it in the future, how I solved it.
I looked and got the highest number of the data for the current Chart and looked if it is near 1000 I rounded it up to 1000, if it is over 1000 I rounded it up to the nearest 200.
For example a number 1059 becomes => 1200 or the number 1215 becomes 1400.
Than simply get this Number and divide it by 4(to have 4 Lines).
And give this number to the yAxis max. For the min set 0.

Highchart/stockChart: Zoom with buttons into monthly-data and show affected columns

I have a simple time-series in highchart:
series: [{
"data": [[Date.UTC(2021,0,1), 22312], // January
[Date.UTC(2021,1,1), 12312], // Feburary
[Date.UTC(2021,2,1), 23322], // ... etc.
],
Now I want to zoom into one month, and show just one column with the given code:
rangeSelector: {
buttons: [{
text: '1m',
type: 'month',
count: 1, // This should show only 1 month, but it shows 2.
// If this is changed to "0", one month will be show, but
// The css "highcharts-button-pressed" is disabled, and you cannot
// see that "1m" was clicked.
},
According to documentation "rangeSelector.buttons.count" should span over an area of one month if type is "month" and count is "1". But what I´m getting here is a span over two months.
Here is an example:
https://jsfiddle.net/ds90vf5r/1/
Question 1: Why is higchart showing two columns instead of one when choosing/clicking on just 1-month (1m)?
Question 2: How can I zoom into the current date and show just one moth (or one column)?

JustGage - change gauge's background color

I'm using justgage.1.0.1.js on my ASP page. I have configured colors for the progress line into 4 sectors like this:
var g1 = new JustGage({
id: "gauge1",
value: 0,
min: 0,
max: 100,
title: "Some Title",
showMinMax: 0,
label: '0 of 2',
levelColorsGradient: false,
countComplete: 0,
countTotal: 2,
levelColors: [ "#ff0000", "#ff9900", "#ffcc00", "#cccc00" ]
});
And in case countComplete = 0 it chows me an empty pipe with a grey background color:
What I need is to change this empty pipe's background to red, but only if countComplete equals 0 and countTotal is greater than 0. In all other cases the background should stay gray:
``
If this is possible to do, can you show me how to do it?
Already figured this out. To change the background of the gauge line, you just have to add a parameter to the gauge's body:
gaugeColor: "#ff0000"

Highcharts x axis formatting options

I am a beginner for highcharts. I was trying something and got stuck. My x axis has values repeated multiple times. Tooltip values should contain date and time as shown. but the thing i want to change is the x axis values. same value must be shown only once and not repeated everywhere where there is data.
X axis format must be DD-MMM and tooltip should be DD-MM-YY HH am/pm .
is this possible?
Here is my trial code
http://jsfiddle.net/j6oqcgp2/
Highcharts.chart('container', {
chart: {
type: 'spline'
},
title: {
text: 'Snow depth at Vikjafjellet, Norway'
},
subtitle: {
text: 'Irregular time data in Highcharts JS'
},
xAxis: {
categories:['01-Feb-17 12 AM','01-Feb-17 01 AM','01-Feb-17 02 AM','02-Feb-17 04 AM','02-Feb-17 05 AM','02-Feb-17 06 AM','02-Feb-17 07 AM'],
labels: {
formatter: function () {
y=(this.value).substring(1,6);
return y;
}
}
},
yAxis: {
title: {
text: 'Snow depth (m)'
},
min: 0
},
tooltip: {
formatter: function () {
y=(this.x).substring(0,15);
return y;
},
shared:false
},
plotOptions: {
spline: {
marker: {
enabled: true
}
}
},
series: [{
name: 'Winter 2012-2013',
// Define the data points. All series have a dummy year
// of 1970/71 in order to be compared on the same x axis. Note
// that in JavaScript, months start at 0 for January, 1 for February etc.
data: [5,10,19,10,4,6,8]
}]
});
and this is how i want it to be
If your x-axis categories are going to be a predictable set of values (for example, four readings on each day), then you simply can add the tickInterval attribute to show a new axis label on when the day changes (see http://api.highcharts.com/highcharts/xAxis.tickInterval).
So, if you had four readings per day, you would add tickInterval: 4 to your x-axis options. This would show an axis label at every fourth reading, or, in this example, once per day.
If, however, your x-axis categories are not predictable (for example, any number of readings per day), you may want to look at this Highcharts demo, which shows a chart with irregular time periods: http://www.highcharts.com/demo/spline-irregular-time. In this demo, you'll see regular, non-repeating axis labels for whatever unit you're measuring (hours, days, etc.) and the data being plotted as frequently as it's recorded in the data.
I hope these examples and resources are helpful for you.