Dependant fields for required true Swagger - swagger

I have these 2 fields.
- name: cropping
in: query
description: Is cropping a specific area from the snapshot.
required: false
style: form
explode: true
schema:
type: boolean
- name: coordinates
in: query
description: Percentages (%) for all 4 dimentions you want to crop.
content:
application/json:
schema:
type: object
required:
- width
- height
- left
- top
properties:
width:
type: integer
height:
type: integer
left:
type: integer
top:
type: integer
cropping, which is not required and It's optional but when it's filled by the user, as true. I am trying to make the coordinates field to be required true as well.
Also In the coordinates object, all 4 keys need to be present. I have added the required to that but it's not working.
Any help would be wonderful. my open API specs as openapi: 3.0.0

Related

highcharts - add label by custom id

I have a sparkline chart of temperature sensor data,
Its a year of data sampled at every 1 min
I first load a blank chart, then I do a server call, bring the results back and display it by calling
getchart.addSeries({
name: thisGroup,
id: probeItem[0],
data: probeDataArray,
keys: ['x', 'y', 'specialId'],
there could be upto 20 series, and they all load on the screen one by one
This renders quite quickly, however I now need to add a label annotation where the temperature goes over a certain Value (i.e. in add a warning symbol when its alarm state)
Currently I'm looping through each point and seeing if its over a certain value:
currentSeries.points.forEach(function (point) {
However this is very slow.
I have an array of the alarms, and can reference them as
['x', 'y', 'specialId']
However I cannot see how I can add an annotation label by x,y or specialId.
I can only seem to add the label if i loop through all the points already rendered
Is there a way to add a label by using my Id's?
I also need to resize the graph and the labels to remain in the same place
Alternatively if this is not possible, is there anyway to add the labels as i'm adding the series?:
getchart.addSeries({
name: thisGroup,
id: CurrentGroupID,
dashStyle: 'ShortDot',
data: groupLogArray,
keys: ['x', 'y', 'specialId'],
showInNavigator: true, //this shows the series data in the small bottom navigator
point: {
events: {
click: function () {
//alert("test click");
}
}
}
});
You can add an annotation by x and y axis values:
chart.addAnnotation({
labels: [{
text: 'Alarm',
point: {
x: 2,
y: 3,
xAxis: 0,
yAxis: 0
}
}]
});
Live demo: http://jsfiddle.net/BlackLabel/k6trha3e/
API Reference: https://api.highcharts.com/class-reference/Highcharts.Chart#addAnnotation
As an alternative, you can also use data labels: http://jsfiddle.net/BlackLabel/n4586xzq/

Column Chart is not Printing when all values are negative

I have a chart that is feeded with positive and negative values, and I thought that it was working perfectly, but suddenly I realize that the columns are not printed when all values are negative....Is there anything I am doing bad??
Here is my code:
new Highcharts.chart('av2', {
chart: {
type: 'column',
height: 500,
},
series: [{
name: 'Direct Purchase',
data: [ { y: -1.82, name: 'DK' }, { y: -19.8, name: 'DL' }]
}]
});
Mixed Values: https://jsfiddle.net/zowcqz09/6/
All Negative Values: https://jsfiddle.net/zowcqz09/5/
Best Regards,
You can use the yAxis options as workaround - Fiddle
Definitely a bug in v6. Even the official demo doesn't render anything if you change it to all negative values. You can use v5 until that is fixed:
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/5.0.14/highcharts.js"></script>
Edit: Fixed in v6.0.1 (https://github.com/highcharts/highcharts/issues/7228).

Set position for each flag in highstock

I'm trying to change the position of each flag in a chart and I'm using highstock.
I add each flag like this:
{
x: time,
shape: 'url(images/indicators/down_fractal.png)',
y:value,
title: ' ',
text: 'Fractal: ' + value
};
And there is my serie config:
seriesConf : {
id: this.uniqueID,
name: this.toString(),
data: this.indicatorData,
type: 'flags',
onSeries: this.options.onSeriesID, //Series ID on which this flags will be rendered
height: 10,
width: 10,
//y: 100,
//turboThreshold: 0
}
The y value is suppose to set the position of flag but its not working?is it even possible to define each flag position?
In this sample you change the y value and nothing happens.
The main i idea is to create a chart like this:
Flag series is rendered directly above the series, there is no y option for point (see API).
I think you want to use simple scatter series with markers, take a look: http://jsfiddle.net/ujgLzkq9/1/
Or use two flag series (one above, and second one below the line), using series.y option.

Can you group multiple candlestick series next to each other in a highstock chart?

Is it possible to have multiple candlestick series on the same axis and have them grouped next to each other like columns? Right now,they render on top of each other if their y values are similar. I have tried the series options related to this( point padding, grouping ) and they do not work.
Yes, you can add the option "dataGrouping" to the series this way:
serie = {
type: 'candlestick',
name: 'test',
data: seriesdata,
dataGrouping: {
enabled: true
}
}
For further information, check this: http://api.highcharts.com/highstock#plotOptions.series.dataGrouping

Why does changing the x value make the the line move up or down?

Why does the following code change the y value on my line graph instead of the x value? (By changing the y value, I mean the line moves up or down, not side to side)
chart.series[0].data[0].update(x = xMin);
The series was originally loaded with the following setup
series: [{
type: 'line',
name: 'Regression Line',
data: [[0, 1.11], [5, 4.51]],
marker: {
enabled: false
},
states: {
hover: {
lineWidth: 0
}
},
enableMouseTracking: false
}]
update ([Mixed options], [Boolean redraw], [Mixed animation])
Update the point with new values.
Parameters
options: Number|Array|Object
The point options. If options is a single number, the point will be given that number as the y value.If it is an array, it will be interpreted as x and y values respectively. If it is an object, advanced options as outlined under series.data are applied.
redraw: Boolean
Defaults to true. Whether to redraw the chart after the point is updated.If doing more operations on the chart, it is a good idea to set redraw to false and call chart.redraw() after.
animation: Mixed
Defaults to true. When true, the update will be animated with default animationoptions. The animation can also be a configuration object with properties durationand easing.
Source
So, change to the following:
chart.series[0].data[0].update({x: 3});
Demo

Resources