I have added the xType="time" to the chart to show the time scale on the x-axis. I am displaying data only for 25 seconds range. Currently, the x-axis is showing the time format as :SS.
So the x-axis shows time in the following format (data showing each second):
:23, :24, :25
What I am getting from the database is time string in the following format:
2019-07-01T10:42:38.621Z
I have tried the following:
new Date(item.date) // shows ':023'
new Date(item.date).getTime() // shows ':023'
new Date(item.date.substring(19, 0)).getTime() // shows ':023'
oscilloscope.oscilloscope.map((item, index) => {
return {
x: new Date(item.date.substring(19, 0)).getTime(),
y: item.data.fuelInjection
}
})
Always getting the same result.
I would like the x-axis to be formatted in HH:MM:SS format.
So the x-axis showing data like:
11:42:05, 11:42:06, 11:42:07
I am showing a range of 25 seconds apart. This seems to be set by the chart automatically as if I change the range to the extent that a couple of minutes are included the time display on x-axis changes to MM:SS format. I still need the HH:MM:SS format thou. Can this be done at all?
To answer my own question week later, I found an answer in different question about react-vis here on the Stack Overflow:
show date in( MM-DD) format in x-axis using react-vis
In my case the solution was:
<XAxis
tickFormat={function tickFormat(d){
const date = new Date(d)
return date.toISOString().substr(11, 8)
}}
/>
That did the job. Hope it will save someone else time.
I am trying to compute a percentage difference between two values - market index levels separated by a period of time (the period will be determined by user input in a Power BI Slicer tool). I don't understand how I can cross reference values DAX uses by the associated date.
Value % difference from Value =
VAR __BASELINE_VALUE = SUM('Equity Markets (2)'[Value])
VAR __VALUE_TO_COMPARE = SUM('Equity Markets (2)'[Value])
RETURN
IF(
NOT ISBLANK(__VALUE_TO_COMPARE),
DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)
)
"Value" is a column in a table "Equity Markets (2)" the table also includes a "Date" column.
What is the syntax for selecting a value from Value based on an associated date?
Apologies for asking such a basic question - feels like 30 sec of googling should have done it for me.
The slicer is engaging with the bar graph correctly - I know becouse I'm measuring the levels. I think all the % changes are zero because I'm evaluating x/x -1
percentage change =
VAR
__EarliestValue = CALCULATE(SUM('Equity Markets (2)'[Value]),
FIRSTDATE('Equity Markets (2)'[Date]))
VAR __LastDateValue = CALCULATE(SUM('Equity Markets (2)'[Value]),
LASTDATE('Equity Markets (2)'[Date]))
RETURN
CALCULATE(
DIVIDE(__LastDateValue,__EarliestValue)-1)
I am using Highstock to create a GANTT style workflow, but I'm using the X-Range Highcharts plugin to allow for start and end dates on the X-axis. I am trying to get grid lines to display on every day, so I set the following on the X-axis:
tickInterval: 24 * 36e5
However, the grid lines only appear on every week. I've searched all over but can't seem to find a solution specific to this problem, any help would be greatly appreciated.
Here's a jsfiddle showing the problem.
Highcharts prevents from rendering too many ticks on the chart. Maybe the current logic is a bit harsh, but you can always use xAxis.tickPositioner, take a look:
tickPositioner: function() {
console.log(this.tickPositions);
var tp = this.tickPositions,
first = tp[0],
last = tp[tp.length - 1],
ticks = [],
interval = 24 * 36e5;
while (first <= last) {
ticks.push(first);
first += interval;
}
return ticks;
},
Demo: http://jsfiddle.net/LeL28nqr/6/
For a better readability, I suggest to change labels.step option - for example set to every 7th day: http://jsfiddle.net/LeL28nqr/7/
i have a column chart and work fine, but i want to allways show positive number, but i force negative number to "divide" bars on top and bottom.
He a example:
Here my code
google.load('visualization','1.1',{packages:['corechart']});
google.setOnLoadCallback(function(){
var GoogleChart=new google.visualization.ColumnChart(document.getElementById( 'chart' ));
var data = google.visualization.arrayToDataTable([
["Age","Male","Female"],
["<15",{"v":0,"f":"0%"},{"v":0,"f":"0%"}],
["15-20",{"v":8.3333333333333,"f":"8,3333333333333%"},{"v":0,"f":"0%"}],
["20-25",{"v":75,"f":"75%"},{"v":-8.3333333333333,"f":"8,3333333333333%"}],
["25-30",{"v":0,"f":"0%"},{"v":0,"f":"0%"}],
["30-35",{"v":0,"f":"0%"},{"v":0,"f":"0%"}],
["35-40",{"v":0,"f":"0%"},{"v":0,"f":"0%"}],
["40-45",{"v":8.3333333333333,"f":"8,3333333333333%"},{"v":0,"f":"0%"}],
["45-50",{"v":0,"f":"0%"},{"v":0,"f":"0%"}],
["50-55",{"v":0,"f":"0%"},{"v":0,"f":"0%"}],
["55-60",{"v":0,"f":"0%"},{"v":0,"f":"0%"}],
[">60",{"v":0,"f":"0%"},{"v":0,"f":"0%"}]
]);
new google.visualization.NumberFormat({"pattern":"#,##%"}).format(data, 1);
new google.visualization.NumberFormat({"pattern":"#,##%"}).format(data, 2);
var options ={
"isStacked":true,
"hAxis":{
"title":"age"
},
"vAxis":{
"title":"Percentage",
"format":"#,##%",
"viewWindowMode":"explicit",
"viewWindow":{
"min":-100,
"max":100
}
}
};
GoogleChart.draw(data, options);
i dont know how to remove negative symbol("-").
Thanks
P.S: Google Charts 1.1
The google visualization pattern format is a subset of the ICU pattern set. By that you can specify subpatterns for both positive and negative numbers to avoid the minus sign (because if the negative subpattern is not specified, you will get the minus prefix by default) :
format: "#,##%;#,##%"
Unfortunetaly this does not work in visualization - it complains about "Too many percent/permills" - but since % is nothing but "Multiply by 100 and show as percentage" - then you can simply add ,00% as a string suffix instead :
vAxis:{
format:"#,##',00%';#,##',00%'",
...
}
new google.visualization.NumberFormat({"pattern":"#,##',00%';#,##',00%'"}).format(data, 1);
new google.visualization.NumberFormat({"pattern":"#,##',00%';#,##',00%'"}).format(data, 2);
Minus sign now removed from both the vAxis and tooltips.
demo -> http://jsfiddle.net/pcvtf7q9/
Assume a table with a date header (days 1 till 31) of a given year and month.
The content of the table depends on the selected year and month of course.
Now, for example, assume to set the background-color of all "weekend" columns to "gray".
With the following code (example from http://scn.sap.com/thread/3360580) we have some problems:
we can only set the background of available data (assume a table with
10 default rows but only 2 entries; so we can only set the background of the first two entries)
we "misuse" the tooltip property (or any other) to handle the background color
removing of class value seems not working this way, if we change year/month of the bound table data we should change the color accordingly
oTemplate.bindProperty("tooltip", bindPath, function(sValue) {
var classToSet = "";
switch (sValue) {
case "A": classToSet = "cssClassX"; break;
case "B": classToSet = "cssClassY"; break;
default: break;
}
cellId = this.getId();
$("#"+cellId).parent().parent().removeClass("cssClassX", "cssClassY");
$("#"+cellId).parent().parent().addClass(classToSet);
}
More or less the question is:
Is there a way to bound the background-color of a full table column on some data?
Wouldn't the sap.me.OverlapCalender be a better choice instead of using a table? Gives you way more freedom, especially when combined with the sap.me.CalendarLegend control
See https://sapui5.hana.ondemand.com/sdk/test-resources/sap/me/OverlapCalendar.html for a working example