I'm new to chartjs and couldn't find any example on this...
Is there a way to stack these charts vertically (same x-axis) with one long y-axis instead of 3 scales/y-axes ?
From this:
To something like this : (just an example)
here an example:
https://jsfiddle.net/Developer2011/ogjewLuz/34/
Thanks
Soo I did some research about it and there is a lot of people with this problem.
The solution that I'm giving to you will have some problems interacting with the final user but if it's just for display maybe this is what you want.
Right here is the example where you can ofcourse add your own format and specifications:
https://jsfiddle.net/4th6rbcw/3/
Related
its been a month since I started using Apache Superset. I have a graph that gives the accuracy of an event occuring on a given hour shown below.
The event occuring is a column named 'prediction' which is either 'Left' or 'Right'. Is there a way to colorize the bars according to the value in 'prediction' column. If the prediction is Left then red colored bar and green colored bar when Right etc. I have checked metadata but I am not sure how I can edit it. Is there a way to achieve this?
I was able to solve it by using the 'prediction' column in breakdown function few days ago. Thank you Kamal for providing an answer as well!
I have a dataset with fields targeted and opens and I need to add calculated field opens per targeted which essentially means doing simple devision of those 2 values.
My calculated field is as follows
{opens}/{targeted}
but then displaying simple table with values they are completely incorrect
If I try any other operator like + * etc calculations are correct.
I'm completely out of ideas on how to debug this. I've simplified the dataset to just columns of targeted and opens, can't get any simpler.
Had the same problem, I fixed it by wrapping the columns with the sum() function. Like this:
sum({opens})/sum({targeted})
I think you need to make AWS understand that you are working with float numbers.
1.0*{opens}/{targeted}
if still not working try also
(1.0*{opens})/({targeted}*1.0)
it should give you the desired output (not tested, let me know if it doesnt work)
I have a table where I need to get the values of the ticked headers as shown. The ALL takes precedence and it will include all headers when ticked.
Here is the working copy of the sheet.,
The expected values are shown in the image below.
The purple cells will have formula, H2, H3 and so for for each row.
I have tried with
=TRANSPOSE(FILTER(Config!A$1:A$16,(INDEX(Config!A$1:G$16,,MATCH(2,Config!$A$1:$1,0) ))=TRUE))
delete H:K range and use in H2:
=INDEX(TRIM(SPLIT(FLATTEN(QUERY(TRANSPOSE(IF(B2:B=TRUE, C1:F1&"♦",
IF(C2:F=TRUE, C1:F1&"♦", ))),,9^9)), "♦")))
Code Guy, see if this formula (need to drag down) does what you want:
=IF(B2,{C$1:F$1},IFERROR(FILTER(C$1:F$1,C2:F2),""))
"Brute-forcing" the solution with IFs kinda works, even though it's inelegant and not scalable to larger number of columns. Might be interesting to re-ask the question with an arbitrary number of columns. Pure formula solution might not be possible.
I recently asked this question: Horizontally-Drawn RowColumn Class for Motif Library (C)?
In my previous question, I was having trouble getting the xmRowColumnWidgetClass to draw horizontally (row-by-row) instead of vertically (column-by-column). After playing around with it, figured out how to switch to horizontal drawing with the following snippet:
XmNorientation, XmHORIZONTAL,
So the code that creates the xmRowColumnWidgetClass instance now looks like this:
rowColumn = XtVaCreateManagedWidget("rowcolumn",
xmRowColumnWidgetClass,
parentWidget,
XmNnumColumns, 3,
XmNorientation, XmHORIZONTAL,
XmNpacking, XmPACK_COLUMN,
XmNspacing, 6,
NULL);
However, my new problem is that for some reason the XmNnumColumns field is now referring to the number of rows, rather than the actual number of columns. Before adding the XmNorientation, XmHORIZONTAL part, the xmRowColumnWidgetClass instance was drawing the objects from left-to-right but it stayed to 3 columns like it was supposed to. Now, it is staying to 3 rows, occasionally creating a horizontal scrollbar which I do not want. I only want vertical scrolling.
So I need the children of the xmRowColumnWidgetClass instance to be drawn horizontally from top to bottom, but I need it to only put a maximum of 3 per row and thus keep it confined within a certain width.
I tried playing around with the XmNnumColumns field, but things that worked with more children did not work for less children, and vice versa. Sometimes it made it 4 or 5 columns rather than 3, and sometimes it made it 2 columns with the 3rd column completely empty. I encountered many issues like this even when experimenting with things like using XmNpacking, XmPACK_TIGHT rather than XmNpacking, XmPACK_COLUMN and other stuff.
If someone is able to find the official documentation of the xmRowColumnWidgetClass and link it, that would be be greatly appreciated.
To anybody familiar with this library:
How do I create a xmRowColumnWidgetClass instance that draws horizontally (row-by-row) while keeping it to a certain number of columns?
It should be able to handle any number of children and add as many rows as it needs to in order to keep it as exactly 3 columns.
Another group of examples of this library:
https://github.com/spartrekus/Motif-C-Examples
https://github.com/spartrekus/Motif-C-Examples/blob/master/rowcol.c
XmRowColumn was designed to implement the top menubar and all the other menu classes... You are searching for a grid like widget, and so you have to use XmForm read the related question for that.
In short: try the WtTable widget
Longer explanation follows:
The behaviour of XmRowColumn regarding "columns" becoming "rows" when you choose a horizontal configuration is very unfortunate. The alternative of using XmForm instead of XmRowColumn for this purpose is feasible, but however it requires manually setting the children constraints, and even then, it's quite possible that you won't be able to achieve the automatic sizing implemented in XmRowColumn.
By searching today, I found the WtTable widget and it works fine for my purposes. It's "almost" as automatic as XmRowColumn and it doesn't require to set any constraints manually. I tried it in my Motif code, and works fine.
Note however that I said "almost" as automatic. The "almost" is because you need to specify the number of columns and rows, and you need to specify the column and row for each child widget. However, all of this can be automated: you can create a convenience function that internally manages counters for columns and rows, so that you pass a widget to such function and it puts it in the cell it belongs automatically: you can even make that function create a new row in the WtTable when it's needed.
Using the QCustomPlot add on for QT. I am having to plot points which may are not linear so the graph could look something like this
how ever this is the result
but this is what shows up
using this code
plotter->addGraph();
plotter->graph(0)->setData(xVector, yVector);
plotter->xAxis->setLabel("X");
plotter->yAxis->setLabel("Y");
plotter->xAxis->setRange(x_data_range_min x_data_range_max);
plotter->yAxis->setRange(y_data_range_min, y_data_range_max);
plotter->replot();
plotter->saveJpg("test.jpg");
plotter->close();
now I found a partial fix, by adding this option to get ride of the connected lines and only show the points,
plotter->graph(0)->setLineStyle((QCPGraph::LineStyle)QCPGraph::lsNone);
plotter->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc , 3));
and the result is this but has a problem, it leaves a kinda bold spot which I can't have
so this is a semi-solution. So I went ahead and added what A. Sarid mentioned in the replys below. I think the first graph may plot fine, but any other graph after it looks like this
so I am not sure which solution can make only the dots connect in the order in which they are received from the array
I just had the same problem few days ago.
You need to use QCPCurve Class instead of Graph. Here is a small example of how to do it:
this->newCurve = new QCPCurve(ui->customPlot->xAxis, ui->customPlot->yAxis);
ui->customPlot->addPlottable(this->newCurve);
And then you can use it the same way you use graph, for example:
this->newCurve->setData(x, y);