I have a candlestick chart with 1 hour intervals. I receive the data like this:
[ [ 1400760000000,
0,
0,
0,
0
],
[ 1400763600000,
0,
0,
0,
0
],
[ 1400767200000,
20,
21,
20,
20
],
[ 1400770800000,
0,
0,
0,
0
],
[ 1400774400000,
19,
19,
19,
19
],
[ 1400778000000,
0,
0,
0,
0
]
]
or I can receive the data like this:
[ [ 1400760000000,
null
],
[ 1400763600000,
null
],
[ 1400767200000,
20,
21,
20,
20
],
[ 1400770800000,
null
],
[ 1400774400000,
19,
19,
19,
19
],
[ 1400778000000,
null
]
]
Is there any way to connect the nulls or zero's?
I've tried setting the connectNulls options to true in series like this:
series : [{
type : 'candlestick',
name : 'AAPL Stock Price',
connectNulls: true,
data : data
}]
But that didn't work.
You should have a null for each parameter (open, close, high, low) like in the example
http://jsfiddle.net/22mrT/
Related
On the y-axis of the spider chart, it reads 0, 100, 20, 30, ...
While the interval is 10 and max value is 100.
How can I make sure Highcharts shows the correct order: 0, 10, 20, ..., 100.
This is a fiddle to show the issue I'm having: https://jsfiddle.net/8g9q3ubd/
"yAxis": {
"gridLineInterpolation": "polygon",
"lineWidth": 0,
"pointInterval": 10,
"min": 0,
"max": 100,
"tickAmount": 10,
"tickInterval": 10,
"tickmarkPlacement": "on",
"categories": ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"]
},
You do not need to use categories property. With tickInterval: 10 only every tenth category is shown and your last category ("100") is shown in second place.
"yAxis": {
"gridLineInterpolation": "polygon",
"lineWidth": 0,
"pointInterval": 10,
"min": 0,
"max": 100,
"tickAmount": 11,
"tickInterval": 10,
"tickmarkPlacement": "on"
}
Live demo: https://jsfiddle.net/BlackLabel/fmo31h7n/
API Reference: https://api.highcharts.com/highcharts/yAxis.categories
I have developed an F# REST service framework which has recently gone into production usage, and one of the follow-up tools I'm working on is an automatic OpenAPI spec generator. The generator uses the FSharp.Compiler.Services library to examine each function exposed as a service entry point and generate the API spec, including schemas for each parameter. These parameters are often single-case union types which use a special rules computation expression to define validation rules, like the following:
type AccoutNubmerValidationError =
| AccountNumberMustBeTenDigitsLong of string
| AccountNumberMustBeNumerical of string
/// Account Number must be a 10-digit numerical string
[<Struct; Validated>] type AccoutNumber = private AccountNumber of string
module AccountNumber =
let create : string -> Result<AccountNumber, AccountNumberValidationError> =
rules {
rule (Rules.length 10) AccountNumberBeTenDigitsLong
rule (Rules.pattern "^[\d]{10}$") AccountNumberMustBeNumerical
}
I would like to parse each rule in the computation expression (which is a CustomOperation on the RulesBuilder class) so I can generate the correct values for length, pattern, etc. on the OpenApi schema for AccountNumber. While I can identify the correct binding and I have the FSharpExpr for the body, I haven't figured out exactly what I would need to do to parse that expression and extract the values for each rule.
If there is any documentation available on how to parse the bodies of computation expressions using F# Compiler Services, I haven't yet been able to find it. Does anyone have any experience they can share to help me figure it out?
EDIT
I received a close vote for 'asking for a tutorial', so I want to clarify my problem. I have an instance of an FSharpMemberOrFunctionOrValue for the create binding in the example above, as well as an FSharpExpr for the body of the expression. The expression looks something like this (represented as JSON to make it readable):
{
"Type": "FSharpImplementationFileDeclaration.MemberOrFunctionOrValue",
"Range": {
"StartLine": 15,
"StartCol": 4,
"EndLine": 15,
"EndCol": 9
},
"Properties": [
[
"v",
"val create"
],
[
"vs",
[]
]
],
"Childs": [
{
"Type": "BasicPatterns.Application",
"Range": {
"StartLine": 15,
"StartCol": 4,
"EndLine": 15,
"EndCol": 9
},
"Properties": [],
"Childs": [
{
"Type": "BasicPatterns.Lambda",
"Range": {
"StartLine": 15,
"StartCol": 4,
"EndLine": 15,
"EndCol": 9
},
"Properties": [
[
"lambdaVar",
"val builder#"
]
],
"Childs": [
{
"Type": "BasicPatterns.Call",
"Range": {
"StartLine": 17,
"StartCol": 8,
"EndLine": 17,
"EndCol": 64
},
"Properties": [
[
"memberOrFunc",
"member Require"
],
[
"typeArg2",
"type Microsoft.FSharp.Core.string"
]
],
"Childs": [
{
"Type": "BasicPatterns.Value",
"Range": {
"StartLine": 17,
"StartCol": 8,
"EndLine": 17,
"EndCol": 64
},
"Properties": [
[
"valueToGet",
"val builder#"
]
],
"Childs": []
},
{
"Type": "BasicPatterns.Call",
"Range": {
"StartLine": 16,
"StartCol": 8,
"EndLine": 16,
"EndCol": 63
},
"Properties": [
[
"memberOrFunc",
"member Require"
],
[
"typeArg2",
"type Microsoft.FSharp.Core.string"
]
],
"Childs": [
{
"Type": "BasicPatterns.Value",
"Range": {
"StartLine": 16,
"StartCol": 8,
"EndLine": 16,
"EndCol": 63
},
"Properties": [
[
"valueToGet",
"val builder#"
]
],
"Childs": []
},
{
"Type": "BasicPatterns.Call",
"Range": {
"StartLine": 16,
"StartCol": 8,
"EndLine": 16,
"EndCol": 63
},
"Properties": [
[
"memberOrFunc",
"member Yield"
],
[
"typeArg2",
"type Microsoft.FSharp.Core.obj * Microsoft.FSharp.Core.string"
]
],
"Childs": [
{
"Type": "BasicPatterns.Value",
"Range": {
"StartLine": 16,
"StartCol": 8,
"EndLine": 16,
"EndCol": 63
},
"Properties": [
[
"valueToGet",
"val builder#"
]
],
"Childs": []
},
{
"Type": "BasicPatterns.Const",
"Range": {
"StartLine": 16,
"StartCol": 8,
"EndLine": 16,
"EndCol": 63
},
"Properties": [
[
"constType",
"type Microsoft.FSharp.Core.unit"
],
[
"constValueObj",
null
]
],
"Childs": []
}
]
},
{
"Type": "BasicPatterns.Call",
"Range": {
"StartLine": 16,
"StartCol": 17,
"EndLine": 16,
"EndCol": 32
},
"Properties": [
[
"memberOrFunc",
"val raise"
],
[
"typeArg2",
"type Microsoft.FSharp.Core.obj"
]
],
"Childs": [
{
"Type": "BasicPatterns.Const",
"Range": {
"StartLine": 16,
"StartCol": 17,
"EndLine": 16,
"EndCol": 32
},
"Properties": [
[
"constType",
"type Microsoft.FSharp.Core.int32"
],
[
"constValueObj",
1
]
],
"Childs": []
}
]
},
{
"Type": "BasicPatterns.Const",
"Range": {
"StartLine": 16,
"StartCol": 34,
"EndLine": 16,
"EndCol": 63
},
"Properties": [
[
"constType",
"type Microsoft.FSharp.Core.string"
],
[
"constValueObj",
"Must be 10 digits in length"
]
],
"Childs": []
}
]
},
{
"Type": "BasicPatterns.Call",
"Range": {
"StartLine": 17,
"StartCol": 17,
"EndLine": 17,
"EndCol": 43
},
"Properties": [
[
"memberOrFunc",
"val raise"
],
[
"typeArg2",
"type Microsoft.FSharp.Core.obj"
]
],
"Childs": [
{
"Type": "BasicPatterns.Const",
"Range": {
"StartLine": 17,
"StartCol": 17,
"EndLine": 17,
"EndCol": 43
},
"Properties": [
[
"constType",
"type Microsoft.FSharp.Core.int32"
],
[
"constValueObj",
1
]
],
"Childs": []
}
]
},
{
"Type": "BasicPatterns.Const",
"Range": {
"StartLine": 17,
"StartCol": 45,
"EndLine": 17,
"EndCol": 64
},
"Properties": [
[
"constType",
"type Microsoft.FSharp.Core.string"
],
[
"constValueObj",
"Must be numerical"
]
],
"Childs": []
}
]
}
]
},
{
"Type": "BasicPatterns.Call",
"Range": {
"StartLine": 15,
"StartCol": 4,
"EndLine": 15,
"EndCol": 9
},
"Properties": [
[
"memberOrFunc",
"val rules"
]
],
"Childs": []
}
]
}
]
}
The problem is, I don't even see a reference to Rules.length or Rules.pattern in this expression tree. Presumably, this must be because I'm creating some intermediate partially-applied function that's represented elsewhere in the expression tree for the program. Is there a deterministic way to identify which portions of the expression tree I need to navigate and then find the actual constant values used in the partially-applied functions so that I can reliably use them programmatically?
I have a JSON
"passengers": [{
"accompaniedByInfant": true,
"birthDate": {
"day": 6,
"fractionalSecond": 0.000,
"hour": 0,
"minute": 0,
"month": 9,
"orig_day": 6,
"orig_fracSeconds": 0.000,
"orig_hour": 0,
"orig_minute": 0,
"orig_month": 9,
"orig_second": 0,
"orig_timezone": 330,
"orig_year": 1991,
"second": 0,
"timezone": 330,
"year": 1991
},
"hasStrecher": false,
"parentSequence": 0,
"passengerTypeCode": "ADLT",
"gender":"M"
"personName": {
"givenName": "v",
"nameTitle": "MR",
"shareMarketInd": false,
"surname": "j"
},
"requestedSeatCount": 1,
"shareMarketInd": false,
"unaccompaniedMinor": false
}, {
"accompaniedByInfant": false,
"birthDate": {
"day": 10,
"fractionalSecond": 0.000,
"hour": 0,
"minute": 0,
"month": 10,
"orig_day": 10,
"orig_fracSeconds": 0.000,
"orig_hour": 0,
"orig_minute": 0,
"orig_month": 10,
"orig_second": 0,
"orig_timezone": 330,
"orig_year": 2010,
"second": 0,
"timezone": 330,
"year": 2010
},
"hasStrecher": false,
"parentSequence": 0,
"passengerTypeCode": "CHLD",
"personName": {
"givenName": "some",
"shareMarketInd": false,
"surname": "child"
},
"requestedSeatCount": 1,
"shareMarketInd": false,
"unaccompaniedMinor": false
},
and so on depending on the number of passengers.
I have to sent this to the server in
let param : [String: Any] =[ "passengers":passengerparameterarray,"pwd": password,"requestPurpose": "MODIFY_PERMANENTLY_AND_CALC","unm": username ]
Here passengerparameterarray is an array of type string.(here is the issue). I stored details of each passenger in an array
paramarray and whenever user finishes adding details, paramarray is added to the passengerparameterarray on position depending on the indexPath. (1 passenger = added on 0th index, 2 = on 0th and 1st index and so on).
But when I send it to server it goes like
"passengers" : [ [ ..... ] ]
This gives me error as I have an array inside of the array. How do I fix this? I try changing to string but that gives me error as String isn't JSON object because of the " coming before { .
I converted each array to JSON Object. But how do i JSON Object the main array? As the Main array is [String]() . If i try changing to [String:Any]() , things like
array.insert()
Wont work.
How do I fix this? I want to add the JSON object into an array and then sent it to the server.
try this
var param : [String:Any] = ["requestedSeatCount" : 1, "gender" : "M", "parentSequence" : 0, "passengerTypeCode" : "ADLT", "shareMarketInd" : false]
param.updateValue(["nameTitle" : "MR", "givenName" : "aaaa", "surname" : "aaa"], forKey: "personName")
param.updateValue(["year" : "2019", "day" : "29", "month" : "5"], forKey: "birthDate")
This was a stupid question. This all happened because originally my array was
var passengerparameterarray = [Array<Any>]()
instead of
var passengerparameterarray = Array<[String: Any]>()
Which as expected stopped me from inserting JSON object which is in the form of "String:Any"
I am currently trying to export 3D geometry to GlTF and I come across an error I don't understand. In a file describing a simple grey cube, I get this on the normals accessor:
[glTF Validator] Accessor element at index 2 is not of unit length: 0.
[glTF Validator] Accessor element at index 5 is not of unit length: 0.
[glTF Validator] Accessor element at index 8 is not of unit length: 0.
[glTF Validator] Accessor element at index 11 is not of unit length: 0.
[glTF Validator] Accessor element at index 14 is not of unit length: 0.
[glTF Validator] Accessor element at index 17 is not of unit length: 0.
[glTF Validator] Accessor element at index 20 is not of unit length: 0.
[glTF Validator] Accessor element at index 23 is not of unit length: 0.
Here is the json:
{
"accessors": [
{
"bufferView": 0,
"byteOffset": 0,
"componentType": 5123,
"normalized": false,
"count": 36,
"type": "SCALAR",
"name": "31546_indices"
},
{
"bufferView": 1,
"byteOffset": 0,
"componentType": 5126,
"normalized": false,
"count": 8,
"type": "VEC3",
"max": [
32.808,
32.808,
32.808
],
"min": [
0.0,
0.0,
0.0
],
"name": "31546_vertices"
},
{
"bufferView": 2,
"byteOffset": 0,
"componentType": 5126,
"normalized": false,
"count": 8,
"type": "VEC3",
"name": "31546_normals"
},
{
"bufferView": 3,
"byteOffset": 0,
"componentType": 5126,
"normalized": false,
"count": 8,
"type": "VEC3",
"name": "31546_color"
}
],
"asset": {
"version": "2.0"
},
"buffers": [
{
"uri": "31546.bin",
"byteLength": 360,
"name": "31546"
}
],
"bufferViews": [
{
"buffer": 0,
"byteOffset": 0,
"byteLength": 72,
"name": "31546_indices"
},
{
"buffer": 0,
"byteOffset": 72,
"byteLength": 96,
"name": "31546_vertices"
},
{
"buffer": 0,
"byteOffset": 168,
"byteLength": 96,
"name": "31546_normals"
},
{
"buffer": 0,
"byteOffset": 264,
"byteLength": 96,
"name": "31546_color"
}
],
"meshes": [
{
"primitives": [
{
"attributes": {
"POSITION": 1,
"NORMAL": 2,
"COLOR_0": 3
},
"indices": 0,
"mode": 4
}
],
"name": "31546"
}
],
"nodes": [
{
"mesh": 0
}
],
"scene": 0,
"scenes": [
{
"nodes": [
0
],
"name": "RNT_Viewport"
}
]
}
I don't understand what the Validator is talking about accessors above 3 as there are only 4 accessors... To get this I used the GlTF plugin for Visual code. For the Khronos online validator, the JSON looks correct (https://github.khronos.org/glTF-Validator/), so at this point, I don't really know where is my mistake...
Thank you in advance for the insight :)
It's complaining here about the binary data, in the 31546.bin file referenced by your JSON. If you click one of the messages in the document problems window, it should focus the cursor on the accessor in question (and I'll go on a limb and guess that would be the accessor at index 2, named 31546_normals, as that looks like the only one that should be normalized in this model).
The actual index values reported in these messages are indexes into the data contained within this accessor. In VSCode, with the correct accessor selected, press ALT + d to decode the binary data into a text buffer, to examine it as text.
My guess as to what's happened here is that you have some zero-length normal vectors in your model. This isn't a big problem if the zero-length vectors are applied to degenerate triangles, but, that sort of thing is at best a waste of space in the bin file that could be removed, so the validator flags it with a warning.
If you're editing this model in some other tool like Blender or Maya, you might have an option to find and remove degenerate triangles, and recalculate normal vectors. This might get rid of your zero-length normals.
Highcharts 5.x.x
I setup zones on a series of data to stop a solid line being drawn at value 0.
This works fine when the yAxis.min and yAxis.max properties are not defined, however after setting those two properties the zones are ignore and a solid line appears.
Toggle comment the yAxis config.
Example
Highcharts.chart('container', {
yAxis: { min: 0, max: 100 },
xAxis: { type: 'datetime' },
series: [
{
data: [
[
1499249640000,
0.003
],
[
1499249700000,
1.9205
],
[
1499249760000,
1.9611
],
[
1499249820000,
1.928
],
[
1499249880000,
0.943
],
[
1499249940000,
0.944
],
[
1499250000000,
0.952
],
[
1499250060000,
0.044
],
[
1499250120000,
0.961
]
],
type: 'area'
},{
zones: [{
value: 0.01,
color: 'rgb(255, 255, 255, 0)'
}],
data: [
[
1499249640000,
0
],
[
1499249700000,
0
],
[
1499249760000,
1.9611
],
[
1499249820000,
0
],
[
1499249880000,
0.943
],
[
1499249940000,
0
],
[
1499250000000,
0
],
[
1499250060000,
0
],
[
1499250120000,
0
]
],
type: 'line'
}]
});