private void chart1_MouseMove(object sender, MouseEventArgs e)
{
//this part helps to get the x and the y coordinate
//this coordinate finding is based on the plotting part of chart element type..
var pos = e.Location;
if (prevPosition.HasValue && pos == prevPosition.Value)
return;
// tooltip.RemoveAll();
prevPosition = pos;
var results = chart1.HitTest(pos.X, pos.Y, false, ChartElementType.PlottingArea);
foreach (var result in results)
{
if (result.ChartElementType == ChartElementType.PlottingArea)
{
var xVal = result.ChartArea.AxisX.PixelPositionToValue(pos.X);
var yVal = result.ChartArea.AxisY.PixelPositionToValue(pos.Y);
currentXAxis = (double)xVal;
currentYAxis = (double)yVal;
//now lets move on to making other part
/*1.find dbt value => this is x axis value
* 2.find sp.ratio value => this is yaxis value
*/
// lb_dbt.Text = Math.Round(xVal, 4).ToString();
//lb_humidity_ratio.Text = Math.Round(yVal, 4).ToString();
//now lets move towards printing the relative humidity at that position and dew point and enthalpy also wbt
//first Relative humidity...
//first we need to see equation w = 622*phi*pg./(patm-phi*pg);
/*
we need to calc phi value given by ycord/30 as the max value is 30..
* second pg which is calculated by temperature pulled from the text file we need to fist
* calculate the round up value of x coord to an integer...
*/
//this part is not correct yet we need to do this again....
double phi = 0.00000;
//double y_axis = yVal;
//now for pg..
ArrayList temperature_value = new ArrayList();
ArrayList pg_value_from_txtfile = new ArrayList();
//--Copying the ref temp and humidity values..
temperature_value = t;
pg_value_from_txtfile = pg;
double temperature = Math.Round(xVal);
double corres_pg_value = 0.000000;
for (int i = 0; i < temperature_value.Count; i++)
{
if (temperature == Double.Parse(temperature_value[i].ToString()))
{
corres_pg_value = Double.Parse(pg_value_from_txtfile[i].ToString());
break;
}
}//close of for
double patm = 101.325;//this is constant...
double w = yVal;
phi = w * patm / (622 * corres_pg_value + w * corres_pg_value);//this phi gives the relative humidty..
phi = phi * 100;//changing into percent..
//now display in label...
// lb_RH.Text = Math.Round(phi, 4).ToString();
//now lets calculate the dew point...
double humidity = phi;
double temperature1 = xVal;
double TD = 243.04 * (Math.Log(humidity / 100) + ((17.625 * temperature1) / (243.04 + temperature1))) / (17.625 - Math.Log(humidity / 100) - ((17.625 * temperature1) / (243.04 + temperature1)));
//now lets print this value..
// lb_DP.Text = Math.Round(TD, 4).ToString();
//now lets move towards enthalpy...
Patm = 1013;
A = 6.116441;
m = 7.591386;
Tn = 240.7263;
B = 621.9907;
double Pws = A * Math.Pow(10, (m * TD) / (TD + Tn));
double X = B * Pws / (Patm - Pws);
h = temperature * (1.01 + (0.00189 * X)) + 2.5 * X;
//now lets display this value ..
// lb_enthalpy.Text = Math.Round(h, 4).ToString();
}
}
//--IF the line is selected/disconnected and then we need to connect to a node
if (flagForDisconnectClick == 1)
{
//--Creating temporary line..
//--then redraw it again...
addTemporarySeries();
//--Now lets move on the showing the hand when hover over the Node lets do it bro...
addCursorFunctionForLineDisconnectConnect(e);
}
else {
disconnectLineToolStripMenuItem.Enabled = false;
//--This is for the weather the line is moverover or not...
LineDeterctOnMouseMove(e);
//--Lets add a function for the process diagram drawing..
ProcessDiagramMouseMoveFunction(e);//--This does the adding and removing part
}
}