I am using jqplot through Primefaces and Have input to Bar Chart like this:
Series 1:
label: "Company 1"
data: {"01-05-2015": 10, "06-05-2015": 3}
Series 2:
label: "Company 2"
data: {"03-05-2015": 10, "06-05-2015": 3}
When I pass this data as BarChartModel, I got data wrongly drawn on the chart.
The data follows the first series, as the Series 2 is drawn after the Series 1 dates. I've to convert the data to be as follows in order to get the chart drawn fine:
Series 1:
label: "Company 1"
data: {"01-05-2015": 10, *"03-05-2015": 0*, "06-05-2015": 3}
Series 2:
label: "Company 2"
data: { *"01-05-2015": 0* , "03-05-2015": 10, "06-05-2015": 3}
Notice the data items between * and *.
Any advice here? (if using DateAxis helps?)
I had the same problem with LinearChartModel when I has not using DateAxis.
As a workaround, I filled my series with all possible data and then reordered the list. Urg!
Should work with BarChartModel too.
Using DateAxis you just need to add your date axis with the timestamp, like this:
serie.set(new Date().getTime(), new Double(123));
or this
serie.set("2015-09-08", new Double(123));
Put the DateAxis in your LineChartModel like this:
DateAxis axis = new DateAxis("Data da inspeção");
linearModel.setZoom(true);
linearModel.getAxes().put(AxisType.X, axis);
linearModel.setExtender("linhaSetor");
And format your date in the extender.js:
function linhaSetor() {
this.cfg.axes.xaxis.tickOptions = {
show : true,
angle : 45,
formatString : '%d/%m/%y %Hh'
};
}
You don't even need to put the data in order.
Related
I have a multiple header data frame and I succeeded to extract the column names by two functions.
I have comparison rows in my data every third line (that compares the two rows values before it) and contains one of the values: "Imporoved", "Not Improved" etc...
For example the table looks something like that:
measure1 | measure2
previouse 70 | 80
new 60 | 100
compare IMPROVED | SIGNIFICANT DEGRADED
I'm trying to add conditional formatting that will color a cell in a certain way if it equals to one of the options of the comparison values. The conditional formatting does not work in a way it does not raise an error but does not display any of the highlighting.
I tried the following code:
style_data_conditional=
[{
'if': {
'filter_query': '{{{col}}} = "SIGNIFICANT DEGRADED"'.format(
col=col),
'column_id': col
},
'backgroundColor': 'black',
'color': '#FF1616'
} for col in columns_names
]
+
[
{
'if': {
'filter_query': '{{{col}}} = "NOT IMPROVED"'.format(
col=col),
'column_id': col
},
'backgroundColor': 'CD7B05',
'color': '#D3C4AF'
} for col in columns_names
]
+
[
{
'if': {
'filter_query': '{{{col}}} = "IMPROVED"'.format(
col=col),
'column_id': col
},
'backgroundColor': '82C729',
'color': '#F4FFE7'
} for col in columns_names
]
+
[
{
'if': {
'filter_query': '{{{col}}} = "SIGNIFICANT IMPROVED"'.format(
col=col),
'column_id': col
},
'backgroundColor': '8FFF0C',
'color': 'white'
} for col in columns_names
]
At first I had a problem with accessing the column names because of the multi headers, but I fixed it and "columns_names" is a list containing the actual columns names (for example columns_names = [['counter1', 'Average'],['counter1', 'max'],...]).
I don't know why the it won't display, the table remains white.
Will appreciate some help!
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)?
I want to import data in a highstock chart per csvURL and the chart works fine up to 250 rows: https://jsfiddle.net/Joh_Christ/qx6gad34/1/
data: {
csvURL: 'https://www.quandl.com/api/v3/datasets/FSE/VOW3_X.csv?api_key=FaKetdwzkQQPhX91Xrhx',
switchRowsAndColumns: false,
firstRowAsNames: true,
startRow: 0,
endRow: 250,
seriesMapping: [{
x: 0,
y: 4
},
{},
{},
{}]
}
When I increase the number of rows, nothing is displayed: https://jsfiddle.net/Joh_Christ/qx6gad34/4/
How can I show the total number of rows from the csv file?
In both charts you have Highcharts error #15:
Highcharts expects data to be sorted
This happens when creating a line
series or a stock chart where the data is not sorted in ascending X
order.
For performance reasons, Highcharts does not sort the data, instead it
requires that the implementer pre-sorts the data.
The difference is that in the second chart cropThreshold property is exceeded and that is why the series is not displayed.
API Reference: https://api.highcharts.com/highstock/series.line.cropThreshold
I guess this is somewhat of a stupid question. But I am struggling since quite a while with this, not finding what the right way of data formatting is for my data.
I have yearly data like this, which I want to have displayed as such - 2001, 2002, 2003, ...:
time,lat,lon,Npp_1km
Date.UTC(2001/1/1),15,-90,1.266112766
Date.UTC(2002/1/1),15,-90,1.166646809
Date.UTC(2003/1/1),15,-90,1.020591489
Date.UTC(2004/1/1),15,-90,1.016010638
Date.UTC(2005/12/31),15,-90,1.08053617
Date.UTC(2006/12/31),15,-90,1.181195745
and my Highcharts code which looks like this:
xAxis: {
labels: {
style: {
color: "#666666"
},
x: 0
},
gridLineWidth: 1,
gridLineDashStyle: 'Dot',
tickWidth: 0,
type: 'datetime'
},
But the xAxis doesn't display the years but instead some "00:00:00.001".
I have tried many different formats for the timestamp - "2001-1-1", "2001/1/1", "1/1/2001", "1-1-2001", "Date.UTC(2001/1/1)". I have changed the "dateTimeLabelFormats" as well. But all in vain. It doesn't spit out "2001 - 2002 - 2003 - 2004".
Here is a fiddle.
What is the right way to achieve this? Thanks for any hints!
You had problems with parsing your data. All of your x values was not correct - that is the reason of your issue. You need to parse it a little bit different if you want to get the correct data for your chart:
$.get('data.csv', function(data) {
var temp = []
// Split the lines
var lines = data.split('\n');
// For each line, split the record into seperate attributes
$.each(lines, function(lineNo, line) {
var items = line.split(',');
if (lineNo !== 0) {
items[0] = items[0].substring(items[0].indexOf('(') + 1, items[0].indexOf(')'));
var x = new Date(items[0]),
y = parseFloat(items[3]);
if (!isNaN(y)) {
x = x.getTime();
options.series[0].data.push([x, y]);
}
}
});
Here you can see an example how it can work:
http://jsfiddle.net/pcpq6mtr/4/
Regards,
A simple solution can be put categories in xAxis if the time is fixed.
xAxis {
categories:[2001,2002,2003,2004,2005,2006]
}
If the time is not fixed. categories need to be calculated dynamically.
Using Restlets I can create any records in NetSuite. However, how do we create records with line items? I know we can use the getLineItemCount, loop through these items and use the setLineItemValue to set the line item.
What I'm not sure about is how we would pass such data to start with. So, we expect an external system to submit some data which I would then need to create POs with line items using my Restlet.
I would ideally like to test this using fire fox Poster, but not sure how to model the data. Something like this works fine to create a normal record using poster by passing data like:
{ "subsidiary" : 2, "entity" : 1084,"currency" : 2,"approvalstatus" : 2}
But how would we send line item data?
My JSon Object looks like this:
{"subsidiary" : 2,
"entity" : 1275,
"currency" : 2,
"approvalstatus" : 2,
"item": [{"item" : -3, "taxrate": 6},
{"item" : -3, "taxrate": 6}]
}
I tried getting the data out of the nested jason object with the below code but doesn't quite work...the itemid is blank
for (var x = 1; x <= jsonobject.item.length; x++)
{
var itemid = record.getLineItemValue('item', jsonobject.item['item'], x);
nlapiLogExecution('DEBUG', 'itemid', itemid)
record.setLineItemValue('item', itemid, x);
}
You could try using an array within your JSON to encapsulate the line items such as:
{"subsidiary" : 2,
"entity" : 1084,
"currency" : 2,
"approvalstatus" : 2,
"items": [{name:"item1", price: "100"},
{name:"item2", price:"200"}]
}
Your RESTlet code would have to then digest this, and call the relevant NS functions you mention.
As TonyH mentioned, your code has a bug wherein you should be getting the array index first. In addition, your index should start at 0, not 1, since you are going through a JS array, not a NetSuite sublist:
for (var x = 0; x < jsonobject.item.length; x++)
{
var itemid = jsonobject.item[x]['item'];
}
The same would go if you want to get the tax rate:
for (var x = 0; x < jsonobject.item.length; x++)
{
var taxrate = jsonobject.item[x]['taxrate'];
}