public TextureHandler(string filename, TEX classic, uint cols = 1, uint rows = 1, int pallet = -1) => Init(filename, classic, cols, rows, pallet);
public ScatterPlot GetScatterData(string cristinID, CancellationToken cancellationToken) { var userData = GetUserData(cristinID, cancellationToken); if (userData == null) { return(null); } else { var scatterPlotData = new ScatterPlot(); var rowList = new List <rows>(); var random = new Random(); string mainPosition = "Professor"; string mainColor = "#ffbd45"; User mainUser = new User { firstName = "Ola", lastName = "Normann" }; string mainPublications = "10"; string mainQuality = "10"; foreach (var match in userData) { string position; if (cristinID == "10") { position = "Professor ii"; } else { position = "Overlege"; } string publications = "10"; string quality = "10"; string color = position == "Professor" || position == "Professor ii" ? "#0077c2" : "#80d6ff"; User user = new User() { firstName = "Ivar", lastName = "Aasen" }; rowList.Add(new rows { c = new List <c> { new c { v = quality, f = user.firstName + " " + user.lastName }, new c { v = publications + "", f = position }, new c { v = color, f = null } } }); } //main rowList.Add(new rows { c = new List <c> { new c { v = mainQuality, f = mainUser.firstName + " " + mainUser.lastName }, new c { v = mainPublications + "", f = mainPosition }, new c { v = mainColor, f = null } } }); cols colums1 = new cols { id = "", label = "", pattern = "", type = "number" }; cols colums2 = new cols { id = "", label = "", pattern = "", type = "number" }; cols colums3 = new cols { id = "", role = "style", type = "string" }; List <cols> columList = new List <cols> { colums1, colums2, colums3 }; scatterPlotData.cols = columList; scatterPlotData.rows = rowList; return(scatterPlotData); } }
public ScatterPlot GetScatterData(string cristinID, CancellationToken cancellationToken) { var userData = new List <SimilarResearcher>(); try { userData = GetUserData(cristinID, cancellationToken); } catch { throw; } if (userData == null) { return(null); } var scatterPlotData = new ScatterPlot(); var rowList = new List <rows>(); using (var db = new dbEntities()) { var filter = GetFilter(); var mainPosition = db.tilhorighet.AsNoTracking().Where(e => e.cristinID == cristinID).Select(t => new { t.posisjon, t.institusjon }) .ToList().OrderByDescending(x => filter.IndexOf(x.posisjon)).FirstOrDefault(); if (mainPosition == null) { return(null); } string mainColor = "#ffbd45"; User mainUser = db.person.AsNoTracking().Where(p => p.cristinID == cristinID) .Select(e => new User { firstName = e.firstname, lastName = e.lastname }) .FirstOrDefault(); var mainRank = db.rank.AsNoTracking().Where(r => r.cristinID == cristinID) .Select(r => new { publications = r.publikasjoner, quality = r.kvalitet }).FirstOrDefault(); if (mainRank.publications == null || mainRank.quality == null || mainUser == null) { return(null); } foreach (var match in userData) { cancellationToken.ThrowIfCancellationRequested(); var rank = db.rank.AsNoTracking().Where(r => r.cristinID == match.cristinID) .Select(r => new { publications = r.publikasjoner, quality = r.kvalitet }).FirstOrDefault(); string color = match.position == "Professor" || match.position == "Professor ii" || match.position == "Dosent" || match.position == "Forsker i" || match.position == "Professor emeritus" ? "#0077c2" : "#80d6ff"; rowList.Add(new rows { c = new List <c> { new c { v = rank.quality, f = match.firstName + " " + match.lastName }, new c { v = rank.publications + "", f = match.position + ", " + match.institution }, new c { v = color, f = null } } }); } //main rowList.Add(new rows { c = new List <c> { new c { v = mainRank.quality, f = mainUser.firstName + " " + mainUser.lastName }, new c { v = mainRank.publications + "", f = mainPosition.posisjon + ", " + mainPosition.institusjon }, new c { v = mainColor, f = null } } }); cols colums1 = new cols { id = "", label = "", pattern = "", type = "number" }; cols colums2 = new cols { id = "", label = "", pattern = "", type = "number" }; cols colums3 = new cols { id = "", role = "style", type = "string" }; List <cols> columList = new List <cols> { colums1, colums2, colums3 }; scatterPlotData.cols = columList; scatterPlotData.rows = rowList; } return(scatterPlotData); }
=> AddRow(cols, RowKeys.Forward[row]);