public CookbookCategoryPage(string categoryName)
        {
            Title       = categoryName;
            Description = $"Example plots and source code demonstrating {categoryName}";

            IRecipe[] recipes = Locate.GetRecipes(categoryName);
            if (recipes.Length == 0)
            {
                throw new InvalidOperationException($"no recipes found of category {categoryName}");
            }

            Add($"<div class='display-5 mt-3'>" +
                $"<a href='../../' style='color: black;'>ScottPlot {Plot.Version} Cookbook</a>" +
                $"</div>" +
                $"<div class='fs-1 fw-light mb-4'>" +
                $"<a href='./' style='color: black;'>{categoryName}</a>" +
                "</div>");

            AddVersionWarning("cookbook page");

            foreach (IRecipe recipe in recipes)
            {
                AddRecipe(recipe);
            }
        }
示例#2
0
        private void AddRecipeCards()
        {
            string[] categoryNames          = Locate.GetCategoriesInDisplayOrder();
            string[] plottableCategories    = categoryNames.Where(x => x.StartsWith("Plottable:")).ToArray();
            string[] nonPlottableCategories = categoryNames.Where(x => !x.StartsWith("Plottable:")).ToArray();

            AddHeading("Cookbook Recipes", 2);

            Add($"<strong>Concepts:</strong> " + string.Join(", ",
                                                             nonPlottableCategories.Select(x => $"<a href='#{Sanitize(x)}'>{x}</a>")));

            Add($"<strong>Plottables:</strong> " + string.Join(", ",
                                                               plottableCategories.Select(x => $"<a href='#{Sanitize(x)}'>{x.Split(':')[1]}</a>")));

            AddSpacer();

            foreach (string categoryName in categoryNames)
            {
                AddHeading(categoryName, 2);
                Add("<div class='row'>");
                foreach (IRecipe recipe in Locate.GetRecipes(categoryName))
                {
                    AddRecipeCard(recipe);
                }
                Add("</div>");
                AddSpacer();
            }
        }
示例#3
0
 public void AddAllRecipies()
 {
     IRecipe[] sortedRecipes = Locate.GetRecipes().OrderBy(x => x.ID).ToArray();
     AddRecipes(sortedRecipes);
 }
示例#4
0
 public void AddRecipiesFromCategory(string category) =>
 AddRecipes(Locate.GetRecipes().Where(x => x.Category == category).ToArray());