ChartJS: Multi line xAxis Label in Time series line chart - chart.js

I have created a sample line chart taken from the chartJS examples and changed the labels and added a configuration to make it a time series chart.
Here is the fiddle: jsfiddle.net/w6dor1f3
My problem is how to split the xAxis label to multi-line. In the code, I changed the format of the date to 'DD-MMM HH:mm'. So if I have '01-Jan 12:00' I want to display it as:
12:00
01-Jan
After looking for some solutions, I found out that you can do so by converting your label into an array. For example, instead of "01-Jan 12:00", you could have ["12:00","01-Jan"]. However, I found out that this doesn't work if the xAxis scale is of type 'time'.
Has anyone encountered this issue?
In case you're wondering, I used time scale in order for the chartjs-plugin-zoom to work.

Related

chart.js issue with display between two charts with same code

I'm having an issue with data vertically too close together in the first chart while the other is not.
Chart With Issues
Chart Without Issues
Transition between charts (scroll down halfway)
Actual Chart to view: http://www.ironclads.com/temp/chart.html
As you can see from the images the text and corresponding chart values are compressed together in the first chart but look ok in the second.
The code is the same and the values in the first chart are 1000, while the second chart is 703. Is this why it compresses the first chart values? If so, is there anything I can do programmatically to resolve the issue between charts or am I on the right track that I just need to get the entry count closer to the same in order for the two charts to look the same?
I'm attaching the code to the html chart file in question as a link below. I also try to limit the number of entries to 1000 or less per chart in order for them to not break the browser or the chart.
Any ideas you have or suggestions are greatly appreciated. Thank you.
http://www.ironclads.com/temp/chart.html
Ok folks. Figured it out with some help elsewhere. It appears a sub wrapper is in order, along with changing that subwrappper to fit. Here's the link to the fixed chart, you can compare the first with this and see the changes.
http://www.ironclads.com/temp/chart_fixed.html

How to forecast in Power BI using DAX

I have a chart in excel I wish to replicate in PBI.
My Excel chart is a bar chart dated axis with 2 series, running up march, but with data only up until now.
Each bar series has a trendline, which forecasts a trend up to the end of the financial year.
In power BI I have tried to replicate, but I cannot seem to add 'forecast' from the analytics tab unless my chart is a line graph.
So I now have 2 line series in a chart like so:
I have added trendline to both but there is no option to add the forecast line unless I only have 1 data series.
As I've removed a series I can now toggle on the forecast line in the analytics tab.
So I now have 1 line series in my line graph like so:
I actually need to have the data and the corresponding forecast for both data series, so I would have series 1 & 2 plotted like above, on the same graph together.
Is there a way to do this on the analytics tab??
If not, how should I go about it? I was thinking I could use DAX to forecast until March 2023 instead and then drag the line into the line graph and format it to dashed?
Thanks
Here is some sample data step by step for what i'm looking for (very simple thing to do in excel!):
This is the same data, pivoted with the 2 series mapped out on a line graph, and trendline added for each:
I just want to be able to show a trendline extending and forecasting forward, past the months I already have like I have done in Excel.
Yeah i think here your best solution would be to use the "what if" parameter in Dax to get the result you need
For a forecasting line to be performed on a line chart, Below requirements should be met. Otherwise You can't see this option on the analytics tab:
You need to change your datasets, and datatypes accordingly.
The last one is especially valid for you, because there is not a one-day period between your data values, in fact monthly organized.

Read value from a different table for Y-axis constant line in Power BI

I have a scatter chart and a db view to get the necessary data from it. This view only returns the names and its's respective values and is enough to make my chart just fine. Problem is that i want to draw a Constant Line on my chart but i want to read its value from a configuration table that i have in my DB. Currently when i try to add the Y-axis constant line in power bi, it only allows me to type the static value and it won't get the data dynamically from somewhere else; a different key-value based table that i already mentioned above. How can i achieve this?
Here's the images:
Thanks in advance.
There is not direct solution for this problem but this workaround did the job for me:
Create a measure (may work with a calculated column that will later be summarized as average, MAX, MIN, etc.). The measure (or aggregation of calculated column) will have the dynamic value of the constant line you want to display. In my case, I used a measure and I am showing a constant line that changes value depending on the current month.
Create your visual without the constant line first. In my case, I am using the clustered bar chart.
Add the measure with the constant value to your list of values of the visual. The value will appear in your visual. In my case, it appeared as another horizontal bar. You'll hide it in a later step.
Go to the analytics tab of the visual and instead of adding a new Constant Line, add a Min Line, Max Line, or whatever line makes more sense for your measure, column, visual, etc. as long as the option you choose allows you to select the measure/column you added in the previous step. From the formatting options of the line you added, click on the dropdown labeled "Measure" and pick the measure that has the value of the constant line.
Finish formatting the line as you want (title, text position, color, etc.).
Go back to the Fields tab of the visual and drag the measure with the constant value from the Value group to the Tooltips group. The value will now disappear from the visual but the constant line should remain.
(optional) If you do not want the value of the now dynamic constant line to show in the Tooltip of the visual, create a custom visual. However, keep in mind that if the user is viewing the report in a way that doesn't support report page tooltips, the user will see the default Tooltip including the value of the dynamic constant line you just created.

Baseline deviation graph in Oracle APEX5.0

In Oracle APEX 5.0 , I want to create a baseline deviation graph where in it should display the graph in below format.
Given X axis is the date column and Y axis is the column with numeric value , I should be able to highlight the least value through a line ( as you can see in above graph the line marked in red is a baseline value ) in addition to the linear display on chart.So far I tried using "D3 Line chart" plugin but seems its not displaying the chart in expected format.
Could you please suggest if its possible to create such a chart? What plugin is required for that?
i think you dont need a plugin
you can achieve this need by using a chart sample with multiple series
and you can give your secondary serie with a fixed baseline value like
SELECT link, label, series_1_value [, series_2_value [, ...]]
FROM ...
SELECT link, label, series_1_value , 2
FROM ...

How to overlay a line plot over a bar graph in APEX?

Right now I have a stacked bar graph and a line graph on one page using apex 'create a region' functionality. I'd like to combine these to one chart. I am thinking if you pehaps create a custom xml code in order to do so, but i'm not sure if that's the right direction to go to. Any help in this regard is appreciated.
No need to fiddle with XML. Create a second series in the chart using the SQL of your second chart and set the 'Series type' attribute to 'Line'.
Check "Multiple Y-Axis" in the display settings to plot your second series with a separate set of Y values. This means the number range offered in both series can be different scales. This can rescale as you show/hide specific series, as offered in one of the Legend properties.
Here is a link to a sample application by Hilary from the APEX team, plenty of examples in there regarding what is possible:
https://apex.oracle.com/pls/apex/f?p=36648