Comments (5)
Please refer to https://reogrid.net/document/customize-function/
unvell.ReoGrid.Formula.FormulaExtension.CustomFunctions["RANK"] = (cell, args) =>
{
// sample code
if (args.Length == 0)
{
// this function needs at least one argument
return null;
}
return Convert.ToString(args[0]).ToUpper();
};
Also will be great if you make the function as a standard built-in function of ReoGrid by pushing your change to this repository.
from reogrid.
Thank you very much.
from reogrid.
Hello Jing, I tried to use RANK in the customize function but I am not getting the desired result
FormulaExtension.CustomFunctions["RANK"] = (cell, args) =>
{
return Rank(cell, args);
};
How do I get the data in the reference cell and rank it in the reference range?
from reogrid.
@segunodu Did you solve this? I am considering to make the RANK function as a built-in function of ReoGrid in next version.
from reogrid.
Hello Jingwood, sorry I have not responded since. I have solved the Rank function issue using a Rank method and creating Customize Rank function.
The method:
public static double Rank<T>(T value, IEnumerable<T> data)
{
return data.OrderByDescending(x => x).ToList().IndexOf(value) + 1;
}
And the Customize function:
FormulaExtension.CustomFunctions["RANK"] = (cell, args) =>
{
if (args.Length < 1 || !(args[0] is CellPosition || args[1] is RangePosition))
{
return null;
}
double cellVal = (double)args[0];
RangePosition rangePos = (RangePosition)args[1];
List <double> rangeNums = new List<double>();
cell.Worksheet.IterateCells(rangePos, (r, c, inCell) =>
{
double rangeVal;
if (CellUtility.TryGetNumberData(inCell.Data, out rangeVal))
{
rangeNums.Add(rangeVal);
}
return true;
});
double[] rangeArray = rangeNums.ToArray();
double numPos = Rank(cellVal, rangeArray);
return numPos;
};
Thank you very much. I hope this method will be easier to add into the next Reogrid release. If you need help creating other Customize functions, let me know.
Thank you.
from reogrid.
Related Issues (20)
- datetime not show time
- Named Range is not displayed in the address bar after 100 columns (column CV)
- An exception occurred during the undo operation
- How to display full text beyond cell limits? HOT 9
- While loading a particualr Excel sheet, in the ReoGrid.Load Function exceptoin is thrown
- how to get cell with column or row header text?
- How to extract the exact value?
- How to add a column to the left of the Column Header, How to add rows on the RowHeader HOT 1
- Context menus on ReoGrid WPF
- WinUI 3 Support
- performance issue HOT 3
- How to adjust column order by dragging and dropping columns HOT 2
- dropdownlist item missing while save/load rgf file
- Does ReoGrid have function to show cell note?
- How to implement CheckBox cell type for entire column. HOT 6
- Getting Error - Exception thrown: 'System.ArgumentOutOfRangeException' in unvell.ReoGrid.dll HOT 3
- Hello, just want to ask...
- data exception HOT 1
- CSV file loading issue HOT 1
- Are there any plans to support Avalonia? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reogrid.