English | 简体中文
<script src="https://github.com/draculakkk/TagEChartsBlazor/raw/master/_content/TagEChartsBlazor/script/echarts.min.js"></script><br/>
<script src="https://github.com/draculakkk/TagEChartsBlazor/raw/master/_content/TagEChartsBlazor/script/common.js"></script>
Property | description |
---|---|
Style | Label style |
ClassName | Class Name |
AutoRender | Any changes to the chart's properties will automatically refresh the chart, which is closed by default |
debugModel | After enabling, the browser console will output the option item of the chart |
OnRenderComplete | OnAfterRender executed delegate |
OnRenderBefore | Delegate before OnAfterRender execution |
theme | Configure the theme of the current echarts chart |
RefreshForce() | Instance method of forcibly refreshing the current echarts chart |
<ECharts Style="width: 800px; height: 400px;">
<Title text="Apache ECharts Getting started example"></Title>
<Legend data="@(new[] { "Sales" })"></Legend>
<Tooltip></Tooltip>
<XAxis>
@foreach (var item in new[] { "Shirt", "Sweater", "Chiffon Shirt", "Pants", "High Heels", "Socks" })
{
<Data value="@item">
<TextStyle color="red"></TextStyle>
</Data>
}
</XAxis>
<YAxis>
<AxisLabel formatter="(value, index) => {return value + ':';}"></AxisLabel>
</YAxis>
<Series name="Sales" type="bar" data="@(new[] { 5, 20, 36, 10, 10, 20 })">
</Series>
</ECharts>
<ECharts Style="width: 800px; height: 400px;">
<Title text="Line chart stacking" />
<Tooltip trigger="axis" />
<Legend data="@(new object[] { "Email Marketing", "Affiliate Advertising", "Video Advertising", "Direct Access", "Search Engine" })" />
<Grid left="3%" right="4%" bottom="3%" containLabel="true" />
<Toolbox>
<Feature>
<SaveAsImage></SaveAsImage>
</Feature>
</Toolbox>
<XAxis type="category" boundaryGap="false" data="@(new object[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" })" />
<YAxis type="value" />
<Series name="Email marketing" type="line" stack="Total" data="@(new[] { 120, 132, 101, 134, 90, 230, 210 })" />
<Series name="Affiliate advertising" type="line" stack="Total" data="@(new[] { 220, 182, 191, 234, 290, 330, 310 })" />
<Series name="Video ad" type="line" stack="Total" data="@(new[] { 150, 232, 201, 154, 190, 330, 410 })" />
<Series name="direct interview" type="line" stack="Total" data="@(new[] { 320, 332, 301, 334, 390, 330, 320 })" />
<Series name="search engine" type="line" stack="Total" data="@(new[] { 820, 932, 901, 934, 1290, 1330, 1320 })" />
</ECharts>
<ECharts Style="width: 800px; height: 400px;"
OnClick="@(new(async (param, chart) =>
{
int zoomSize = 6;
var sv = dataAxis[System.Math.Max(param.dataIndex.GetValueOrDefault(0) - (zoomSize / 2), 0)];
var ev = dataAxis[System.Math.Min(param.dataIndex.GetValueOrDefault(0) + (zoomSize / 2), data.Length - 1)];
await chart.DispatchActionAsync(new DataZoomDispatchAction(DataZoomDispatchType.dataZoom, startValue: sv, endValue: ev));
}))">
<Title text="Feature example: gradient color shadow click to zoom" subtext="Feature Sample: Gradient Color, Shadow, Click Zoom"></Title>
<XAxis data="dataAxis" z="10">
<AxisLabel inside="true">
<TextStyle color="#fff" />
</AxisLabel>
<AxisTick show="false" />
<AxisLine show="false" />
</XAxis>
<YAxis>
<AxisLabel>
<TextStyle color="#999" />
</AxisLabel>
<AxisTick show="false" />
<AxisLine show="false" />
</YAxis>
<DataZoom type="inside" />
<Series type="bar" showBackground="true" data="data">
<ItemStyle>
<Color x="0" y="0" x2="0" y2="1" colorStops="@(new ColorStops[] { new ColorStops(0, "#83bff6"), new ColorStops(0.5f, "#188df0"), new ColorStops(1, "#188df0") })" />
</ItemStyle>
<Emphasis>
<Color x="0" y="0" x2="0" y2="1" colorStops="@(new ColorStops[] { new ColorStops(0, "#2378f7"), new ColorStops(0.7f, "#2378f7"), new ColorStops(1, "#83bff6") })" />
</Emphasis>
</Series>
</ECharts>
@inject EChartsHelper echartHelper
@inject HttpClient Http
@if (initSuccess)
{
<ECharts Style="width: 800px; height: 400px;" theme="wyy"
OnMouseOver="@(new(async (param, chart) =>
{
await chart.DispatchActionAsync(new DispatchAction(DispatchType.highlight, geoIndex: 0, name: param.name));
}, new { seriesIndex = 0 }))"
OnMouseOut="@(new(async (param, chart) =>
{
await chart.DispatchActionAsync(new DispatchAction(DispatchType.downplay, geoIndex: 0, name: param.name));
}, new { seriesIndex = 0 }))">
<Tooltip />
<Geo left="10" right="50%" map="organ_diagram" selectedMode="true">
<Emphasis focus="self">
<ItemStyle color="null" />
<Label position="bottom" distance="0" textBorderColor="#fff" textBorderWidth="2" />
</Emphasis>
<Blur />
<Select>
<ItemStyle color="#b50205" />
<Label show="false" textBorderColor="#fff" textBorderWidth="2" />
</Select>
</Geo>
<Grid left="60%" top="20%" bottom="20%" />
<XAxis />
<YAxis data="@(new object[] { "heart", "large-intestine", "small-intestine", "spleen", "kidney", "lung", "liver" })" />
<Series type="bar" data="@(new[] { 121, 321, 141, 52, 198, 289, 139 })">
<Emphasis focus="self" />
</Series>
</ECharts>
}
@code {
private bool initSuccess;
protected async override Task OnInitializedAsync()
{
string mapsvg = await Http.GetStringAsync("asset/Veins_Medical_Diagram_clip_art.svg");
await echartHelper.RegisterMapAsync(new RegisterMapOption("organ_diagram", opt: new MapOpt(svg: mapsvg)));
string json = await Http.GetStringAsync("json/chalk.json");
await echartHelper.RegisterThemeAsync("wyy", json);
initSuccess = true;
}
}