How to Mark 0 line for X axis and Y axis in MSChart c# - mschart

I have implemented a MsChart which displays the values properly. Everything is running fine. My problem is i need to highlight grid line for 0 on X axis and 0 on Y axis. all other grid lines will be in different color other than there 2. Please suggest Thanks in advance.

I have figured it out.
if someone need reference here it is:
Area.axisX.Linecolor = color.Red;

Related

(scaled) y value for given x value

I'm modifying some examples [1][2] to draw a line on the canvas. For the end-point I have calculated a data value but now I want to calculate the y value on the canvas.
In the examples I found
this.chart.chart.scale.getPixelForValue()
which seems deprecated in chart.js 2.6
// Used to get data value locations. Value can either be an index or a numerical value
getPixelForValue: helpers.noop,
The first example uses
this.calculatePointY()
but that doesn't help me either.
What would I use instead?
[Note]: This question is similar but has no answers: Get Y value of line from X pixel value in ChartJS 2
[1] https://stackoverflow.com/a/39118152
[2] https://stackoverflow.com/a/37222238
For ChartJS - version 2.6, you should use the following ...
chart.scales['y-axis-0'].getPixelForValue(<value>);

How do I plot a seaborn factorplot on a matplotlib subplot

For some reason, I just can't get this to work. What I end up getting is two grids with axes plotted on top of each other and then the second plot plotted under this. My code works fine for a seaborn distplot:
plt.subplot(121)
h = sns.distplot(dfmain["Runs"])
plt.subplot(122)
j = sns.distplot(dfHighScores["Runs"])
But if I try and plot two factor plots side by side (they are independent so I don't want the axes to be shared), then this just doesn't work as described above:
plt.subplot(121)
h = sns.factorplot("Runs",data=dfmain)
plt.subplot(122)
j = sns.factorplot("Runs",data=dfHighScores)
I get this behavior whether I use an iPython notebook or spyder as my IDE. Any help would be greatly appreciated.
According to the documentation of factorplot it should be able do draw two plots side by side by itself. If you combine both your data frames into one (and add a column to tell between them) then something like this should work:
sns.factorplot("Runs", col="mainOrHighScores", data=dfCombined)
Otherwise I think factorplot doesn't operate on axes (unlike distplot).
In any case only functions that have an "ax" parameter for axes can draw on axes.

Rotating a model around all 3 (X, Y, Z) axis in DirectX 11.2 C++

I have the next problem. I am trying to rotate a 3D model around all 3 axis at the same time. Meaning i want to rotate the model around the X axis, then the Y axis, then again the X and so forth by pressing the buttons on the keyboard. The problem is when i use XMMatrixRotationX, XMMatrixRotationY or XMMatrixRotationZ like this:
void Rotate(float radians_x, float radians_y, float radians_z)
{
DirectX::XMStoreFloat4x4(&_transfer.world, DirectX::XMMatrixTranspose(DirectX::XMMatrixRotationZ(radians_z)));
DirectX::XMStoreFloat4x4(&_transfer.world, DirectX::XMMatrixTranspose(DirectX::XMMatrixRotationY(radians_y)));
DirectX::XMStoreFloat4x4(&_transfer.world, DirectX::XMMatrixTranspose(DirectX::XMMatrixRotationX(radians_x)));
}
only the last rotation gets done. I want to be able to rotate the object around each of the axis by a specific angle (actually, radians), as you can see in the code. I have found out that the XMMatrixRotationAxis method does this, but it only takes one angle parameter, and i want to use a different one for each axis. Can anyone help me about how can this be done?
Also, i don't know what to send as a first parameter to the XMMatrixRotationAxis, it just says a vector of axis. I don't understand how do i access those, the methods i used in the code posted don't need to be sent any axis. I dont understand why is this necessary, or how to do it, in case this is the right solution.
Any help would be much appreciated.
I have found the answer here:
http://books.google.hr/books?id=7ZkLAAAAQBAJ&pg=PA251&lpg=PA251&dq=XMMatrixRotationQuaternion&source=bl&ots=xveQhsj-x_&sig=Ny6IdK1JNFBF99LyC_HY8b-y4tI&hl=hr&sa=X&ei=dtkQVOmmA8aXatfugZgL&ved=0CHEQ6AEwCA#v=onepage&q=XMMatrixRotationQuaternion&f=false
I have to use the XMMatrixRotationRollPitchYaw. The code now looks:
void Rotate(float radians_x, float radians_y, float radians_z)
{
DirectX::XMStoreFloat4x4(&_transfer.world, DirectX::XMMatrixTranspose(DirectX::XMMatrixRotationRollPitchYaw(radians_x, radians_y, radians_z)));
}
Works like a charm :)

Connecting Circles in C++/Excel

This is quite complicated to explain, so I will do my best, sorry if there is anything I missed out, let me know and I will rectify it.
My question is, I have been tasked to draw this shape,
(source: learnersdictionary.com)
This is to be done using C++ to write code that will calculate the points on this shape.
Important details.
User Input - Centre Point (X, Y), number of points to be shown, Font Size (influences radius)
Output - List of co-ordinates on the shape.
The overall aim once I have the points is to put them into a graph on Excel and it will hopefully draw it for me, at the user inputted size!
I know that the maximum Radius is 165mm and the minimum is 35mm. I have decided that my base [Font Size][1] shall be 20. I then did some thinking and came up with the equation.
Radius = (Chosen Font Size/20)*130. This is just an estimation, I realise it probably not right, but I thought it could work at least as a template.
I then decided that I should create two different circles, with two different centre points, then link them together to create the shape. I thought that the INSIDE line will have to have a larger Radius and a centre point further along the X-Axis (Y staying constant), as then it could cut into the outside line.*
*(I know this is not what it looks like on the picture, just my chain of thought as it will still give the same shape)
So I defined 2nd Centre point as (X+4, Y). (Again, just estimation, thought it doesn't really matter how far apart they are).
I then decided Radius 2 = (Chosen Font Size/20)*165 (max radius)
So, I have my 2 Radii, and two centre points.
This is my code so far (it works, and everything is declared/inputted above)
for(int i=0; i<=n; i++) //output displayed to user
{
Xnew = -i*(Y+R1)/n; //calculate x coordinate
Ynew = pow((((Y+R1)*(Y+R1)) - (Xnew*Xnew)), 0.5); //calculate y coordinate
AND
for(int j=0; j<=n; j++)//calculation for angles and output displayed to user
{
Xnew2 = -j*(Y+R2)/((n)+((0.00001)*(n==0))); //calculate x coordinate
Ynew2 = Y*(pow(abs(1-(pow((Xnew2/X),2))),0.5));
if(abs(Ynew2) <= R1)
cout<<"\n("<<Xnew2<<", "<<Ynew2<<")"<<endl;
I am having the problem drawing the crescent moon that I cannot get the two circles to have the same starting point?
I have managed to get the results to Excel. Everything in that regard works. But when i plot the points on a graph on Excel, they do not have the same starting points. Its essentially just two half circles, one smaller than the other (Stops at the Y axis, giving the half doughnut shape).
If this makes sense, I am trying to get two parts of circles to draw the shape as such that they have the same start and end points.
If anyone has any suggestions on how to do this, it would be great, currently all I am getting more a 'half doughnut' shape, due to the circles not being connected.
So. Does anyone have any hints/tips/links they can share with me on how to fix this exactly?
Thanks again, any problems with the question, sorry will do my best to rectify if you let me know.
Cheers
Formular for points on a circle:
(x-h)^2+(y-k)^2=r^2
The center of the circle is at (h/k)
Solving for y
2y1 = k +/- sqrt( -x^2 + 2hx +r^2 - h^2)
So now if the inner circle has its center # h/k , the half-moon will begin # h and will stretch to h - r2
Now you need to solve the endpoint formular for the inner circle and the outter circle and plot it. Per x you should receive 4 points (solve the equation two times, each with two solutions)
I did not implement it, but this would be my train of thought...

Reverse y axis and bars in MS Chart

I am trying to reverse the Y Axis in MSChart
The scale from left to right would be 5 - 1
So if a bar has a value of 2 it will fill from 5 until 2 on the scale with the score to the right of the filled bar.
This link shows exactly what I am trying to achieve
http://www.hfi.com/images/graph.png
Is this possible with MS Chart?
Thanks
Have you tried using IsReversed property on the Y axis.