/// <summary> /// /// </summary> /// <param name="element"></param> /// <param name="config"></param> /// <exception cref="NotImplementedException"></exception> public FusionChartWrapper(IChartElement element, IChartConfig config) { _element = element; _config = config??_config; _elementName = determineName(_element); _eltype = _elementName.To<FusionChartElementType>(); _charttype = config.Type.To<FusionChartType>(); }
/// <summary> /// Проверяет доступность атрибута для данного элемента в конфигурации /// </summary> /// <param name="name"></param> /// <param name="chartType"></param> /// <param name="elementType"></param> /// <param name="config"></param> /// <returns></returns> private static bool IsMatch(string name, FusionChartType chartType, FusionChartElementType elementType = FusionChartElementType.Chart, IChartConfig config = null) { var key = (elementType.ToString() + "_" + name).ToLower(); if (Attributes.ContainsKey(key)) { return 0 != (Attributes[key].Charts & chartType); } //custom attribute return true; }
/// <summary> /// /// </summary> /// <param name="element"></param> /// <param name="config"></param> /// <exception cref="NotImplementedException"></exception> public FusionChartWrapper(IChartElement element, IChartConfig config) { _element = element; _config = config ?? _config; _elementName = determineName(_element); _eltype = _elementName.To <FusionChartElementType>(); _charttype = config.Type.To <FusionChartType>(); }
/// <summary> /// Проверяет доступность атрибута для данного элемента в конфигурации /// </summary> /// <param name="name"></param> /// <param name="chartType"></param> /// <param name="elementType"></param> /// <param name="config"></param> /// <returns></returns> private static bool IsMatch(string name, FusionChartType chartType, FusionChartElementType elementType = FusionChartElementType.Chart, IChartConfig config = null) { var key = (elementType.ToString() + "_" + name).ToLower(); if (Attributes.ContainsKey(key)) { return(0 != (Attributes[key].Charts & chartType)); } //custom attribute return(true); }
/// <summary> /// Находит все атрибуты по указанному критерию /// </summary> /// <param name="chartType"></param> /// <param name="element"></param> /// <param name="name"></param> /// <returns></returns> public static IEnumerable<FusionChartAttributeDescriptor> FindAttributes(FusionChartType chartType = FusionChartType.None, FusionChartElementType element = FusionChartElementType.None, string name = null) { return Attributes.Values.Where( _ => { if (chartType != FusionChartType.None) { if (0 == (_.Charts & chartType)) return false; } if (element != FusionChartElementType.None) { if (_.Element != element) return false; } if (!string.IsNullOrWhiteSpace(name)) { if (name.ToLower() != _.Name.ToLower()) return false; } return true; } ); }
/// <summary> /// Находит все атрибуты по указанному критерию /// </summary> /// <param name="chartType"></param> /// <param name="element"></param> /// <param name="name"></param> /// <returns></returns> public static IEnumerable <FusionChartAttributeDescriptor> FindAttributes(FusionChartType chartType = FusionChartType.None, FusionChartElementType element = FusionChartElementType.None, string name = null) { return(Attributes.Values.Where( _ => { if (chartType != FusionChartType.None) { if (0 == (_.Charts & chartType)) { return false; } } if (element != FusionChartElementType.None) { if (_.Element != element) { return false; } } if (!string.IsNullOrWhiteSpace(name)) { if (name.ToLower() != _.Name.ToLower()) { return false; } } return true; } )); }