How can i disable series animation in highchart tree map? - c#

I wrote the following code to disable the series animation :
Animation = new Animation{Enabled = false},
But after runing my application , the problem still persists.
My code to display the treemap is as follows:
#{ var chartOptions =
new Highcharts
{
Title = new Title
{
Text = ""
},
Credits = new Credits
{
Enabled = false
},
Series = new List<Series>
{
new TreemapSeries
{
Animation = new Animation{Enabled = false},
LayoutAlgorithm = TreemapSeriesLayoutAlgorithm.Squarified,
AlternateStartingDirection = true,
Levels = new List<TreemapSeriesLevels>
{
new TreemapSeriesLevels
{
Level = 1,
LayoutAlgorithm = TreemapSeriesLevelsLayoutAlgorithm.Squarified,
DataLabels = new TreemapSeriesDataLabels()
{
Enabled = true,
Align = TreemapSeriesDataLabelsAlign.Left,
VerticalAlign = TreemapSeriesDataLabelsVerticalAlign.Top
}
}
},
Data = #ViewBag.resultGreen
,
}
}
};
chartOptions.ID = "chart";
chartOptions.PlotOptions.Series.Animation.Enabled = false;
var renderer = new HighchartsRenderer(chartOptions);
}
#Html.Raw(renderer.RenderHtml())
How can i solve this problems?
I tried to solve this problem by the link below:
How to disable animations on Highcharts Dotnet C# MVC?

The provided answer in the mentioned thread looks to be related to DotNet.Highcharts. If you use the official Highcharts .NET wrapper use the AnimationBool option:
new TreemapSeries
{
AnimationBool = false,
...
}
API Reference:
https://dotnet.highcharts.com/Help/Highcharts/html/class_highsoft_1_1_web_1_1_mvc_1_1_charts_1_1_treemap_series.html#a3b53a65560c6917e7ee52e1779335b2e

Related

NoTextEdit ShapeLock is not working - OpenXML SDK

I am trying to make a TextBox locked by using OpenXML SDK. I've tried this method but the TextBox NoTextEdit is not working.
public DocumentFormat.OpenXml.Presentation.Shape GenerateShape(string StrText)
{
DocumentFormat.OpenXml.Presentation.Shape shape1 = new DocumentFormat.OpenXml.Presentation.Shape();
DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties nonVisualShapeProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualShapeProperties();
DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties nonVisualDrawingProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)3U, Name = "ID",Hidden=true ,Description="Do not Remove" ,MCAttributes=null };
DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties nonVisualShapeDrawingProperties1 = new DocumentFormat.OpenXml.Presentation.NonVisualShapeDrawingProperties();
Drawing.ShapeLocks shapeLocks1 = new Drawing.ShapeLocks() { NoTextEdit = true, NoGrouping = true,NoMove=true,NoSelection=true,NoEditPoints=true ,NoAdjustHandles=true ,NoRotation=true,NoChangeArrowheads=true,NoChangeAspect=true,NoChangeShapeType=true,NoResize=true};
nonVisualShapeDrawingProperties1.Append(shapeLocks1);
ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties1 = new ApplicationNonVisualDrawingProperties();
PlaceholderShape placeholderShape1 = new PlaceholderShape() { Type = PlaceholderValues.SubTitle, Index = (UInt32Value)1U };
applicationNonVisualDrawingProperties1.Append(placeholderShape1);
nonVisualShapeProperties1.Append(nonVisualDrawingProperties1);
nonVisualShapeProperties1.Append(nonVisualShapeDrawingProperties1);
nonVisualShapeProperties1.Append(applicationNonVisualDrawingProperties1);
DocumentFormat.OpenXml.Presentation.ShapeProperties shapeProperties1 = new DocumentFormat.OpenXml.Presentation.ShapeProperties();
DocumentFormat.OpenXml.Presentation.TextBody textBody1 = new DocumentFormat.OpenXml.Presentation.TextBody();
Drawing.BodyProperties bodyProperties1 = new Drawing.BodyProperties();
Drawing.ListStyle listStyle1 = new Drawing.ListStyle();
Drawing.TextShape shp = new Drawing.TextShape();
Drawing.Paragraph paragraph1 = new Drawing.Paragraph();
Drawing.EndParagraphRunProperties endParagraphRunProperties1 = new Drawing.EndParagraphRunProperties() { Language = "en-US" ,Dirty=false };
paragraph1.Append(GenerateRun(StrText));
paragraph1.Append(endParagraphRunProperties1);
textBody1.Append(bodyProperties1);
textBody1.Append(listStyle1);
textBody1.Append(paragraph1);
shape1.Append(nonVisualShapeProperties1);
shape1.Append(shapeProperties1);
shape1.Append(textBody1);
return shape1;
}
public Drawing.Run GenerateRun(string StrText)
{
Drawing.Run run1 = new Drawing.Run();
Drawing.RunProperties runProperties1 = new Drawing.RunProperties() { Language = "en-US", Dirty = false };
runProperties1.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
Drawing.Text text1 = new Drawing.Text();
text1.Text = StrText;
Drawing.SolidFill solidFill2 = new Drawing.SolidFill();
Drawing.SchemeColor schemeColor = new Drawing.SchemeColor();
string y = System.Drawing.Color.Transparent.ToArgb().ToString("X");
Drawing.RgbColorModelHex rgbColorModelHex2 = new Drawing.RgbColorModelHex() { Val = "FFFFFF" };//Set Font-Color to Blue (Hex "0070C0").
solidFill2.Append(rgbColorModelHex2);
runProperties1.Append(solidFill2);
Color color = new Color() { Val = "365F91", ThemeColor = ThemeColorValues.Accent1, ThemeShade = "BF" };
run1.Append(runProperties1);
run1.Append(text1);
return run1;
}
Everything works fine except editing. Still the user can edit the TextBox values by double clicking it. How can I avoid this ?
Is there any permanent solution to prevent editing ? Please help me to find a better solution.
Thanks in advance
By researching and communications with the MVP team I've pointed out that there is no way to Protect the TextBox from editing.
As Cindy Meister mentioned in the comments,
Are you able to do it in the PowerPoint application user interface? If not, then Open XML cannot do it... If yes, you can.
If you do not want to text to be changed , Just change it as image then lock that by using NoSelection=true/1 and NoMove=true/1 properties. If you enable these properties the user can't either delete nor change it's position.
For your ref: https://answers.microsoft.com/en-us/msoffice/forum/msoffice_powerpoint-mso_windows8-mso_2016/shape-lock-is-not-working/c1705b55-d2aa-4adb-b538-574ed2fc8eca?tm=1579265435636&page=1&rtAction=1579495439869

How to customize Adaptive-Cards in WebChat?

This question is an extension of my previous question.
(How can I put "AdaptiveActionSet" in "AdaptiveColumn"?)
At the time, I didn't know much about the customization of adaptive cards and the WebChat.html file.
The image above is the layout of the adaptive card I want.
The Reserve button on the right is Action.OpenUrl button.
To place a button like that, I need to put an ActionSet in a Column. However, typical Adaptive Cards do not show ActionSet in Column as in the image above.
The content type is shown below.
ContentType = "application/vnd.microsoft.card.adaptive"
(In web chat)
To solve this, I have to customize Adaptive Cards, but I'm not sure how.
(Ashamed,
I referred to the link below but still I can't customize the card.
Bot Connector service is not using latest Adaptive Cards #87
Can you show me a way to solve this or show a simple customized card example? Please.
Below is the code I wrote.
My Adaptive Cards Code :
card.Body.Add(new AdaptiveColumnSet()
{
Columns = new List<AdaptiveColumn>()
{
new AdaptiveColumn()
{
//(~Date, No problem)
},
new AdaptiveColumn()
{
//(~Price, No problem)
},
new AdaptiveColumn()
{
Items =
{
new AdaptiveActionSet()
{
Actions =
{
new AdaptiveOpenUrlAction()
{
Url = new Uri("https://www.SomeUrl.com"),
Title = "Reserve",
Style = "positive",
}
}
}
},
Width = "auto",
}
},
});
var reply = turnContext.Activity.CreateReply();
reply.Attachments = new List<Attachment>
{
new Attachment()
{
ContentType = "application/vnd.microsoft.card.custom",
Content = card
}
};
My webChat.html :
const attachmentMiddleware = () => next => card => {
if (card.attachment.contentype === 'application/vnd.microsoft.card.custom'){
card.attachment.contentType = 'application/vnd.microsoft.card.adaptive'
}
return next(card)
};
window.WebChat.renderWebChat({
directLine: botConnection,
styleOptions,
adaptiveCardHostConfig,
attachmentMiddleware
}, document.getElementById('webchat'));
document.querySelector('#webchat > *').focus();
As above, ContentType = "application/vnd.microsoft.card.custom"
If I assign custom to contentType,
I get an error called No renderer.
Using AdaptiveColumn's SelectAction solved the problem.
And it by using AdaptiveTextBlock and SelectAction together and specifying Width.
ex)
Items =
{
new AdaptiveTextBlock()
{
HorizontalAlignment = AdaptiveHorizontalAlignment.Center,
Color = AdaptiveTextColor.Light,
Text = "Reserve",
Weight = AdaptiveTextWeight.Bolder,
}
},
SelectAction = new AdaptiveOpenUrlAction()
{
Url = new Uri($"{someurl}"),
Title = "rsv",
Id = "bb" + cnt,
},
Width = "50px"

Update Default Root Object of Cloud front Distribution in C#

I have a simple C# windows forms app. What I am trying to accomplish is modify the Default Root Object of one of my Cloud front Distributions. I can't seem to find any related articles that describes how this is accomplished. Please help
After alot of trial and error Here's the C# code to update an AWS cloud front distribution. You will need AWS's new modularized assemblies. AWSSKD.Core v3 & AWSSDK.Cloudfront.
First you need to get the current Distribution for 2 reasons. Mostly for validation you'll need to grab the Etag and Caller Reference. Etag to var and Caller Reference to string.
var client2 = new AmazonCloudFrontClient();
var tag = client2.GetDistributionConfig(new GetDistributionConfigRequest
{
Id = "YOURDISTID"
}).ETag;
string cf = client2.GetDistributionConfig(new GetDistributionConfigRequest
{
Id = "YOURDISTID"
}).DistributionConfig.CallerReference;
client2.Dispose();
Next you will need to make a update to the distribution. What I have below is the minimally required to update a distribution (Pretty much Everything you see in the AWS console when editing a distribution.
Take notice of where tag variable and cf string are used. If the Etag's do not match you will get 400 bad request back.
var client = new AmazonCloudFrontClient();
client.UpdateDistribution(new UpdateDistributionRequest
{
Id = "YOURDISTID",
DistributionConfig = new DistributionConfig
{
WebACLId = "",
HttpVersion = "http2",
IsIPV6Enabled = true,
DefaultRootObject = "maintenance.html",
CacheBehaviors = new CacheBehaviors {
Quantity = 0,
},
Restrictions = new Restrictions {
GeoRestriction = new GeoRestriction
{
Quantity = 0,
RestrictionType = "none"
}
},
CustomErrorResponses = new CustomErrorResponses {
Quantity = 0
},
ViewerCertificate = new ViewerCertificate {
SSLSupportMethod = "sni-only",
ACMCertificateArn = "YOUR_IMPORTED_CERT_ARN",
MinimumProtocolVersion = "TLSv1.1_2016"
},
Enabled = true,
Comment = "Maintenance",
Origins = new Origins
{
Items = new List<Origin>() {
new Origin(){Id = "S3-example.example.com", DomainName = "example.example.com.s3.amazonaws.com", S3OriginConfig = new S3OriginConfig(){ OriginAccessIdentity = "" }, OriginPath = "", CustomHeaders = new CustomHeaders{ Quantity = 0 } }
},
Quantity = 1
},
Logging = new Amazon.CloudFront.Model.LoggingConfig
{
Bucket = "example.example.com.s3.amazonaws.com",
IncludeCookies = false,
Enabled = false,
Prefix = ""
},
PriceClass = "PriceClass_All",
Aliases = new Aliases
{
Quantity = 1,
Items = list
},
CallerReference = cf,
DefaultCacheBehavior = new DefaultCacheBehavior
{
ForwardedValues = new ForwardedValues
{
QueryString = false,
QueryStringCacheKeys = new QueryStringCacheKeys {
Quantity = 0
},
Headers = new Headers {
Quantity = 0
},
Cookies = new CookiePreference
{
Forward = "none"
}
},
AllowedMethods = new AllowedMethods {
Quantity = 2,
Items = httpmeth,
CachedMethods = new CachedMethods
{
Quantity = 2,
Items = httpmeth
}
},
DefaultTTL = 86400,
Compress = false,
MaxTTL = 31536000,
TargetOriginId = "S3-example.example.com",
LambdaFunctionAssociations = new LambdaFunctionAssociations {
Quantity = 0
},
ViewerProtocolPolicy = "allow-all",
MinTTL = 0,
SmoothStreaming = false,
TrustedSigners = new TrustedSigners
{
Enabled = false,
Quantity = 0,
},
}
},
IfMatch = tag
});
client.Dispose();
If you have issues with ACMCertificationARN not being found in the reference Assembly chances are you are using the old v2 AWSSDK. Remove\Uninstall it. Get the latest Nuget Package for AWSSKD.Core & AWSSDK.CloudFront
Nuget Package Manager Console Install:
Install-Package AWSSDK.Core -Version 3.3.21.17
Install-Package AWSSDK.CloudFront -Version 3.3.6.3

Exporting OxyPlot chart to png in asp.net phoject

I'm using asp.net for generating pdf file. In pdf i must show plot. I decided using oxyplot with exporting it in png and inserting in pdf. The documentation says using PlotModel, filling it with series and axes and simply export by using PngExporting object. But when I'm trying generate it, nothing is presented except the axes.
The code I'm using:
var _plotModel = new OxyPlot.PlotModel()
{
PlotAreaBorderColor = OxyPlot.OxyColors.Transparent,
LegendBorder = OxyPlot.OxyColors.Transparent,
TitleToolTip = "Temperature",
Culture = new System.Globalization.CultureInfo("ru-Ru"),
Series =
{
new OxyPlot.Series.LineSeries()
{
ItemsSource = new List<SimplePointModel>
{
new SimplePointModel { Date = DateTime.Now, Temperature = 36.6f },
new SimplePointModel { Date = DateTime.Now.AddDays(1), Temperature = 42.6f },
new SimplePointModel { Date = DateTime.Now.AddDays(2), Temperature = 48.6f },
},
MarkerFill = OxyPlot.OxyColor.Parse("#A9CF9C"),
MarkerType = OxyPlot.MarkerType.Circle,
MarkerSize = item.ListSegments[0].Count() == 1 ? 2 : 1,
DataFieldX = "Date",
DataFieldY = "Temperature",
XAxisKey = "Date",
YAxisKey = "Temperature",
Color = OxyPlot.OxyColor.Parse("#A9CF9C"),
}
},
Axes =
{
new OxyPlot.Axes.DateTimeAxis()
{
Position = OxyPlot.Axes.AxisPosition.Bottom,
Key = "Date",
ToolTip = "Temperature",
AbsoluteMinimum = OxyPlot.Axes.Axis.ToDouble(DateTime.Now.Date),
AbsoluteMaximum = OxyPlot.Axes.Axis.ToDouble(DateTime.Now.AddDays(10000))
},
new OxyPlot.Axes.LinearAxis()
{
Position = OxyPlot.Axes.AxisPosition.Left,
Key = "Temperature",
ToolTip = "Temperature",
IsZoomEnabled = false,
IsPanEnabled = false,
}
}
};
using (var stream = System.IO.File.Create(Path.Combine(folder, "temp.png")))
{
PngExporter.Export(_plotModel, stream, 800, 400, OxyPlot.OxyColors.Transparent);
}
What can I do?
I found solution: we must load data to Points list parameter in Series object instead of ItemSource parameter. ItemSource parameter used in mobile version of library.

How to use MonoTouch.Dialog's ActivityElement?

I might be missing something here, but this code:
this.oSectionDRs = new Section()
{
new ActivityElement()
{
Caption = Locale.GetLocale("Settings_Loading"),
Animating = true
}
};
// To begin with just show a loading indicator.
this.Root = new RootElement (Locale.GetLocale("Settings_Select"))
{
this.oSectionDRs
};
Does not show any animated thingy. It is showing the label only. How can I get the animated star?
Using this code:
var root = new RootElement("foo");
root.Add (new Section("foo", "bar") {
new ActivityElement()
{
Caption = "foo",
Animating = true
}
});
var dvc = new DialogViewController(root, false);
window.RootViewController = dvc;
I get both the caption and the activity scroller thing. Not sure it helps you tho! I was just using the built in MT.D.

Categories