seems to be a bug in nvd3 lineWithFocusChart for small set of data - angularjs

Please see the plunker http://plnkr.co/edit/tO5IgK2Bcx5fDKXCkFgH?p=preview. Initially there are so many repetitions of x-ticks for the same data value. Then, when I select Date Range slider, main chart x-ticks are getting changed to some peculiar dates like 01/01/70, etc. Purposely I have given small data set. Even though the data is in standard format lineWithFocusChart is not working properly, how can fix this? Is it a bug in nvd3 lineWithFocusChart?
$scope.data = [
{
"values": [
{
"series": 0,
"y": 0.3,
"x": 1394841600000
},
{
"series": 0,
"y": 0.3,
"x": 1394928000000
}
],
"key": "ABC"
}
];
Note : I have commented large data set in my plunker. For large data set lineWithFocusChart is working fine.

Related

How can I select a field and nested array from a JSON using JSONPath?

From the contacts, I'd like to select the values in fields: "Id" (47) and everything from the nested array [doNotContact]. I could use some help defining the JSONPath-filter I should be using to select the values: 47 and each value inside the nested array.
{
"total": "1",
"contacts": {
"47": {
"id": 47,
"isPublished": true,
"dateAdded": "2015-07-21T12:27:12-05:00",
"createdBy": 1,
"createdByUser": "Joe Smith",
"doNotContact": [{
"id": 2,
"reason": 2,
"comments": "",
"channel": "email",
"channelId": null
}]
}
}
}
I have tried paths like: $.contacts.*.['id','doNotContact'] however, this does not seem to work. I am using the website: https://goessner.net/articles/JsonPath/ normally this would help me solve the problem.
Not all implementations support the comma-delimited selectors, e.g. ['id','doNotContact']. See the JSON Path comparison project site (specifically this test) for information as to which implementations support the syntax.
Secondly, please see this answer about omitting the dot before a bracket syntax

Azure Data Factory - skipped rows with empty collection reference when flattening JSON

I am trying to serialize the following JSON to Parquet using ADF Copy Activity:
[
{
"mac": "06A1E8A75834",
"timestamp": "2020-11-06T00:00:00+02:00",
"floor_number": 2,
"x": 300.00,
"y": 350.00,
"located_inside": true,
"zones": [
{
"zone_map_name": "sections",
"zone_name": "z_1_"
}
]
},
{
"mac": "06A1E8A75835",
"timestamp": "2020-11-06T00:00:00+02:00",
"floor_number": 2,
"x": 300.00,
"y": 300.00,
"located_inside": true,
"zones": []
}
]
However in some cases the zones array is empty and the rest of the record is skipped.
The expected behavior is when the array is empty - the zone_name and zone_map_name are empty.
The mapping looks like this:
Is there a way to tell ADF how to treat empty collection reference as empty values in rows?
As we know, ADF will skipped rows with empty collection reference when flattening JSON.
When we uncheck that box.
ADF will copy all the items to destination, like this:
[{"mac":"06A1E8A75834","timestamp":"2020-11-06T00:00:00+02:00","floor_number":2,"x":300.0,"y":350.0,"located_inside":true,"zone_map_name":"sections","zone_name":"z_1_"}
,{"mac":"06A1E8A75835","timestamp":"2020-11-06T00:00:00+02:00","floor_number":2,"x":300.0,"y":300.0,"located_inside":true}
]

Find similar documents/records in database

I have a quite big number of records currently stored in mongodb, each looks somehow like this:
{
"_id" : ObjectId("5c38d267b87d0a05d8cd4dc2"),
"tech" : "NodeJs",
"packagename" : "package-name",
"packageversion" : "0.0.1",
"total_loc" : 474,
"total_files" : 7,
"tecloc" : {
"JavaScript" : 316,
"Markdown" : 116,
"JSON" : 42
}
}
What I want to do is to find similar data record based on e.g., records which have about (+/-10%) the number of total_loc or use some of the same technologies (tecloc).
Can I somehow do this with a query against mongodb or is there a technology that fits better for what I want to do? I am fine with regenerating the data and storing it e.g., in elastic or some graph-db.
Thank you
One of the possibility to solve this problem is to use Elasticsearch. I'm not claiming that it's the only solution you have.
On the high level - you would need to setup Elasticsearch and index your data. There are various possibilities to achieve: mongo-connector, or Logstash and JDBC input plugin or even just dumping data from MongoDB and putting it manually. No limits to do this job.
The difference I would propose initially is to make field tecloc - multivalued field, by replacing { to [, and adding some other fields for line of code, e.g:
{
"tech": "NodeJs",
"packagename": "package-name",
"packageversion": "0.0.1",
"total_loc": 474,
"total_files": 7,
"tecloc": [
{
"name": "JavaScript",
"loc": 316
},
{
"name": "Markdown",
"loc": 116
},
{
"name": "JSON",
"loc": 42
}
]
}
This data model is very trivial and obviously have some limitations, but it's already something for you to start and see how well it fits your other use cases. Later you should discover nested type as one of the possibility to mimic your data more properly.
Regarding your exact search scenario - you could search those kind of documents with a query like this:
{
"query": {
"bool": {
"should": [
{
"term": {
"tecloc.name.keyword": {
"value": "Java"
}
}
},
{
"term": {
"tecloc.name.keyword": {
"value": "Markdown"
}
}
}
],
"must": [
{"range": {
"total_loc": {
"gte": 426,
"lte": 521
}
}}
]
}
}
}
Unfortunately, there is no support for syntax with +-10% so this is something that should be calculated on the client.
On the other side, I specified that we are searching documents which should have Java or Markdown, which return example document as well. In this case, if I would have document with both Java and Markdown the score of this document will be higher.

Plotly legends overlapping on top of the chart

By using plotly, I am creating my analytics dashboard which has pie, bar and different kind of charts. I have a pie chart which has huge data and legends nearly more than 60. It's rendering properly in browser(bigger screen) problem is with the mobile screens. Chart legends are overlapping the actual chart.I am expecting to show chart as like below in mobile screens. Can anyone help me on this.
My Json looks like below.
{
"data": [{
"values": [1058,177,75,53,28,23,15,8,7,6,5,5,2,2,1,1,1,1,1,1,0],
"labels": ["Vision Corporation","Corporate Human Resources","Human Resources-West","Human Resources-East","Human Resources-Central","Recruiting-East","Human Resources","Recruiting-South","Payroll","Recruiting-West","Human Resources-South","Recruiting-Central","200-Human Resources","Direction des Ressources Humaines","Accounts Payable","Commercial Sales","Commercial Sales-West","Services-East","Vision Australia","Vision Industries","Others"],
"type": "pie",
"textposition":"inside"
}],
"linked": {
"layout": {
"legend":{
"orientation": "h",
"x": 1.02,
"xanchor": "center",
"y": 1.0,
"yanchor": "bottom"
},
"margin":{
"l": 0
}
}
}
}
Disclaimer: have not tried this on mobile. However, I had a similar issue on the browser (huge legend) - and the following did solve the issue:
You can control the size of the chart. By increasing the height property, you will leave more room for your legend.
Add a 'height' property under the 'layout' object, and play with the sizing to fit your data -
"layout": {
"height": 1000, ...
You can also add a width property if needed. See an example here (not in JSON, but the properties are clear).

Multiple grids from the same store

I need to display product-wise sales data on grid panels on ExtJs3.2 - one grid per product.
The data is received year-wise,and is loaded into a jsonstore.
{"list": [
{
"Year": "2014",
"product": "IS",
"total": "5.0",
},
{
"Year": "2013",
"product": "IS",
"total": "5.6",
},
{
"Year": "2014",
"product": "NS",
"total": "5.7",
},
{
"Year": "2013",
"product": "NS",
"total": "5.1",
}
....
......
]
}
The response is processed to convert into a product-specific 'keyed' dictionary.
{ "IS":[{"Year":"2013","total":"5.1"},{"Year":"2013","total":"5.1"}..],
"NS":[{"Year":"2013","total":"5.1"},{"Year":"2013","total":"5.1"}..],
..}
Each key(and values) are then loaded into separate array stores to feed the respective grids.
Though simplistic - too many objects/structures are being created to achieve this.
Is there a more elegant way to load multiple grids from extracts of the store data?
If you have important reasons not to switch to MVC ExtJS 4 or MVVC ExtJS 5 you could provide data the needed way on server side. E.g. by Node.js what is fetching the JSON and reworking this. Your request could be more specific and your client App would become faster.
An other way would be to write convert() functions into your Ext.data fields and use them as source for the grid.

Resources