I have a Google Sheet with a formula that calulates a price based on different data provided by a Google Form. If I use arrayformula (my formula) in some cases I have a wrong calculation, while if I type the formula directly in the cell I receive the right output.
I've solved the issue by removing the arrayformula, but I wonder if there might be a different solution
This sometimes fails:
=arrayformula(SE(X2:X = "SI";SE(AB2:AB = "SI"; SE(E(Z2:Z = "SI"; Y2:Y = "NO");15;40); 50); SE(AC2:AC = "SI"; SE(AE2:AE ="SI"; SE(E(Z2:Z = "SI"; Y2:Y ="NO");10;25); 35); 50)))
This is working:
=SE(NON(VAL.VUOTO(X9));SE(X9:X = "SI";SE(AB9 = "SI"; SE(E(Z9 = "SI"; Y9:Y = "NO");15;40); 50); SE(AC9 = "SI"; SE(AE9 ="SI"; SE(E(Z9 = "SI"; Y9 = "NO");10;25); 35); 50));)
Text is in Italian, the keywords are:
SE = IF
E = AND
NON = NOT
VAL.VUOTO = ISBLANK
your arrayformula should be:
=ARRAYFORMULA(
IF(X2:X = "SI";
IF(AB2:AB = "SI";
IF((Z2:Z = "SI") * (Y2:Y = "NO"); 15; 40); 50);
IF(AC2:AC = "SI";
IF(AE2:AE = "SI";
IF((Z2:Z = "SI") * (Y2:Y = "NO"); 10; 25); 35); 50)))
Related
I hope you are doing well. I have trained my forecasting model via ML.net in VS 2022. The model is working very well for predicting the amount of income per day and number of patients. My problem is that I cannot train the model. To be Honest! I cannot extract the suitable parameters for ForecastSsa algorithm.
Here is the code:
string[] PersianDates = new string[5];
int[] PatientCounts = new int[5];
ModelOutput ML_Out = PatientPrediction_Consumption.Predict(null, horizon: 31);
float[] Number_TotalPrices = new float[5];
DateTime DateTimeNow = DateTime.Now;
for (int IndexDay = 0; IndexDay <= 4; IndexDay++)
{
DateTimeNow = DateTimeNow.AddDays(1);
PersianCalendar CDP = new PersianCalendar();
Number_TotalPrices[IndexDay] = ML_Out.TotalPrice_UB[CDP.GetDayOfMonth(DateTimeNow)]
- ML_Out.TotalPrice[CDP.GetDayOfMonth(DateTimeNow)];
PersianDates[IndexDay] = FarsiCalendar(DateTimeNow, false);
PatientCounts[IndexDay] = (int)Number_TotalPrices[IndexDay] / 120000;
PatientPrediction_Predicted =
PatientPrediction_Predicted + "\n" + "تاریخ:" + PersianDates[IndexDay] +
"- در آمد:" + Number_TotalPrices[IndexDay] +
" - تعداد مراجعین:" + PatientCounts[IndexDay] + "<br/f>";
}
I am using a Amcharts4 Line series with valueX and valueY instead of categoryX.
Currently I am able to see the tooltip on a hover of bullet/bubble but I also want to see the tooltip of all bullets if they are intersecting and overlapping with each other.
It shows the tooltip if i hover on a single bullet/bubble but if you see the red and green line intersecting each other, it shows the tooltip of green bullet/bubble only, not the other which is hidden at its back.
Click here to see Line Series graph with ValueX and ValueY
This is my code where I am having 3 series and setup a tooltip for each bullet :
let series1 = chart.series.push(new am4charts.LineSeries());
series1.cursorTooltipEnabled = true;
series1.showTooltipOn = 'hover';
series1.dataFields.valueY = "compressorCap";
// series1.dataFields.categoryX = "evapDegC"; // If X-Axis is Category Axis
series1.dataFields.valueX = "evapDegC"; // If X-Axis is Value Axis
series1.name = "Compressor capacity";
let series1toolTip = series1.bullets.push(new am4charts.CircleBullet());
series1toolTip.tooltipText = "{name} in {valueX}°C => {valueY}";
series1.tooltip.getFillFromObject = false;
series1.tooltip.background.fill = am4core.color("#b9a9e6");
series1.legendSettings.valueText = "{valueY}";
series1.visible = false;
series1.stroke = am4core.color("#b9a9e6");
let series2 = chart.series.push(new am4charts.LineSeries());
series2.cursorTooltipEnabled = true;
series2.showTooltipOn = 'hover';
series2.dataFields.valueY = "evapCoilCap";
// series2.dataFields.categoryX = "evapDegC"; // If X-Axis is Category Axis
series2.dataFields.valueX = "evapDegC"; // If X-Axis is Value Axis
series2.name = 'Evaporator coil capacity';
let series2toolTip = series2.bullets.push(new am4charts.CircleBullet());
series2toolTip.tooltipText = "{name} in {valueX}°C => {valueY}";
series2.tooltip.getFillFromObject = false;
series2.tooltip.background.fill = am4core.color("red");
series2.legendSettings.valueText = "{valueY}";
series2.stroke = am4core.color("red");
let series3 = chart.series.push(new am4charts.LineSeries());
series3.cursorTooltipEnabled = true;
series3.showTooltipOn = 'hover';
series3.dataFields.valueY = "evapCoilSensibleCap";
// series3.dataFields.categoryX = "evapDegC"; // If X-Axis is Category Axis
series3.dataFields.valueX = "evapDegC"; // If X-Axis is Value Axis
series3.name = 'Evaporator sensible cooling capacity ';
let series3toolTip = series3.bullets.push(new am4charts.CircleBullet());
series3toolTip.tooltipText = "{name} in {valueX}°C => {valueY}";
series3.tooltip.getFillFromObject = false;
series3.tooltip.background.fill = am4core.color("#13bb37");
series3.legendSettings.valueText = "{valueY}";
series3.stroke = am4core.color("#13bb37");
// Add chart cursor
chart.cursor = new am4charts.XYCursor();
chart.cursor.behavior = "zoomY";
In order to display multiple tooltips, you need to set tooltipText directly on series, not on a bullet.
series.tooltipText = "{name} in {valueX}°C => {valueY}";
That's the first step, though. Since you are using all-ValueAxis scenario, you will also need to apply a workaround as stated in this tutorial.
am4charts.ValueAxis.prototype.getSeriesDataItem = function(series, position) {
var key = this.axisFieldName + this.axisLetter;
var value = this.positionToValue(position);
var dataItem = series.dataItems.getIndex(series.dataItems.findClosestIndex(value, function(x) {
return x[key] ? x[key] : undefined;
}, "any"));
return dataItem;
}
This will enable multi-cursors across all charts.
Or if you want to enable for just for a single axis:
valueAxisX.getSeriesDataItem = function(series, position) {
var key = this.axisFieldName + this.axisLetter;
var value = this.positionToValue(position);
var dataItem = series.dataItems.getIndex(series.dataItems.findClosestIndex(value, function(x) {
return x[key] ? x[key] : undefined;
}, "any"));
return dataItem;
}
If you don't want to show all tooltips for all the series all the time, you can set cursor's maxTooltipDistance to a small number so that multiple tooltips are shown only if target items are closely packged together, e.g.:
chart.cursor.maxTooltipDistance = 10;
The figure font size doubled unexpectedly between knits. Restarting R did not fix the issue. I ended up decreasing font size by 50% to fix the problem. Has this happened to anyone else? My theme is shown below.
style <- theme(plot.title = element_text(face = "bold", size = 30),
plot.subtitle = element_text(size = 30),
axis.title = element_text(size = 25, face="italic"),
axis.text = element_text(size = 25),
legend.text = element_text(size = 25),
legend.title = element_text(face = "bold", size = 25),
legend.position = "bottom",
panel.background = element_rect(fill = NA),
panel.grid.major = element_line(colour = "grey88"),
axis.ticks = element_line(color=NA),
axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)),
axis.title.x = element_text(margin = margin(t = 20, r = 0, b = 0, l = 0)))
If it changes between knits, maybe you were zoomed in on your web browser and didn't know it. it also might depend on your knit R chunks. if you can't replicate the issue, it might just be a random issue.
Can we add any shape/image with chart data labels in ASPOSE .I need to show one arrow with different colors according to certain values with each data labels in the chart. i am using ASPOSE to generate my ppt. Or there is any way to find the data label positions in ASPOSE.
I have observed your requirements and like to share that MS PowerPoint supports LineWithMarker chart that can display different predefined or custom marker symbols(in the form of image) for different series data points. Please try using following sample code for possible options using Aspose.Slides and MSO charts.
public static void TestScatter()
{
var location = System.Reflection.Assembly.GetExecutingAssembly().Location;
//Open a presentation
Presentation pres = new Presentation();
IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.StackedLineWithMarkers, 10, 10, 400, 400);
//populating cycle
var serie = chart.ChartData.Series[0];
var wbk = chart.ChartData.ChartDataWorkbook;
chart.ChartData.Series.RemoveAt(1);
chart.ChartData.Series.RemoveAt(1);
serie.Marker.Format.Fill.FillType = FillType.Picture;
serie.Marker.Size = 20;
// Set the picture
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(#"C:\Users\Public\Pictures\Sample Pictures\Tulips.jpg");
IPPImage imgx = pres.Images.AddImage(img);
serie.Marker.Format.Fill.PictureFillFormat.Picture.Image = imgx;
//For individual data point
serie.DataPoints[0].Marker.Format.Fill.FillType = FillType.Solid;
serie.DataPoints[0].Marker.Format.Fill.SolidFillColor.Color = Color.Red;
serie.DataPoints[0].Marker.Size = 20;
serie.DataPoints[0].Marker.Symbol = MarkerStyleType.Triangle;
serie.DataPoints[0].Label.DataLabelFormat.ShowValue = true;
serie.DataPoints[1].Label.DataLabelFormat.ShowValue = true;
serie.DataPoints[2].Label.DataLabelFormat.ShowValue = true;
serie.DataPoints[3].Label.DataLabelFormat.ShowValue = true;
pres.Save(Path.Combine(Path.GetDirectoryName(location), "Result2.pptx"), SaveFormat.Pptx);
}
I am working as Support developer/ Evangelist at Aspose.
Many Thanks,
I have further observed your requirements and have observed that you have also posted the similar requirements in Aspose.Slides official support forum as well. Please try using following sample code on your end to serve the purpose.
public static void TestLineChart()
{
var location = System.Reflection.Assembly.GetExecutingAssembly().Location;
//Open a presentation
Presentation pres = new Presentation();
IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.StackedLineWithMarkers, 10, 10, 400, 400);
//populating cycle
var serie = chart.ChartData.Series[0];
var wbk = chart.ChartData.ChartDataWorkbook;
chart.ChartData.Series.RemoveAt(1);
chart.ChartData.Series.RemoveAt(1);
serie.Marker.Format.Fill.FillType = FillType.Picture;
serie.Marker.Size = 20;
serie.Marker.Symbol = MarkerStyleType.Diamond;
serie.Marker.Format.Fill.FillType = FillType.Solid;
serie.Marker.Format.Fill.SolidFillColor.Color=Color.Orange;
serie.Marker.Format.Line.FillFormat.FillType = FillType.Solid;
serie.Marker.Format.Line.FillFormat.SolidFillColor.Color=Color.Red;
serie.Marker.Format.Line.Width=1.0F;
serie.Format.Line.Width = 3.0f;
serie.Format.Line.FillFormat.FillType=FillType.Solid;
serie.Format.Line.FillFormat.SolidFillColor.Color = Color.FromArgb(209,225,91) ;
for(int i=0;i<serie.DataPoints.Count;i++)
{
serie.DataPoints[i].Label.DataLabelFormat.ShowValue = true;
IDataLabel label=serie.Labels[i];
chart.ValidateChartLayout();
IAutoShape ashp=chart.UserShapes.Shapes.AddAutoShape(ShapeType.Triangle,chart.X + label.ActualX + 5, chart.Y + label.ActualY + 5, 20,20);
ashp.FillFormat.FillType = FillType.Solid;
ashp.LineFormat.FillFormat.FillType = FillType.NoFill;
if (i % 2 == 0)//even data points
{
ashp.FillFormat.SolidFillColor.Color = Color.Green;
}
else
{
ashp.Rotation = 180;
ashp.FillFormat.SolidFillColor.Color = Color.Red;
}
}
pres.Save(Path.Combine(Path.GetDirectoryName(location), "Result2.pptx"), Aspose.Slides.Export.SaveFormat.Pptx);
}
I am working as Support developer/ Evangelist at Aspose.
Many Thanks,
How does one order the bar chart series to render from most to least? Ordering the data before binding does not seem to help.
My code:
chart.Series.Add("port");
chart.Series["port"].Type = SeriesChartType.Bar;
chart.Series["port"]["PointWidth"] = "0.6";
chart.Series["port"]["BarLabelStyle"] = "Center";
chart.Series["port"].ShowLabelAsValue = true;
chart.Series["port"].Points.DataBind(myData, "Key", "Value", "Label=Value{p2}");
chart.Series["port"].BorderStyle = ChartDashStyle.Solid;
chart.Series["port"].BorderColor = Color.White;
chart.Series["port"].BorderWidth = 1;
chart.Series["port"].ShowLabelAsValue = true;
chart.Series["port"].Font = myfont;
chart.ChartAreas.Add("Default");
chart.ChartAreas["Default"].BackColor = Color.Transparent;
foreach (var axis in chart.ChartAreas["Default"].Axes)
{
axis.LabelStyle.Font = myfont;
axis.MajorGrid.Enabled = false;
}
chart.ChartAreas["Default"].AxisX.Interval = 1;
chart.ChartAreas["Default"].AxisY.LabelStyle.Format = "p0";
You need to call Sort() on the series, see http://msdn.microsoft.com/en-us/library/dd455394.aspx. So to sort the points from most to least you'd do
chart.Series["port"].Sort(PointSortOrder.Descending);
There are two other sort methods incase you need to sort by something other than the point value.